git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: GIT Mailing-list <git@vger.kernel.org>
Subject: Re: Incorrect diff-parseopt conversion?
Date: Fri, 24 May 2019 16:40:53 +0700	[thread overview]
Message-ID: <CACsJy8AzY4EO_io_8R41uVDsbCj+_Fn8YOQ8e+JmAC27dFW7UA@mail.gmail.com> (raw)
In-Reply-To: <791da98b-4065-e477-92cb-ceac80cc04e6@ramsayjones.plus.com>

On Wed, May 22, 2019 at 7:35 AM Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
>
>
>
> On 22/05/2019 01:11, Duy Nguyen wrote:
> > On Wed, May 22, 2019 at 2:56 AM Ramsay Jones
> > <ramsay@ramsayjones.plus.com> wrote:
> >>
> >> Hi Duy,
> >>
> >> I am in the middle of rebasing a long running branch onto
> >> current master (v2.22.0-rc1) and noticed something odd with
> >> commit af2f368091 ("diff-parseopt: convert --output-*",
> >> 2019-02-21).
> >>
> >> As part of the branch I am rebasing, I have defined a new
> >> OPT_LL_CALLBACK() macro[1], which I had intended to apply to
> >> the 'output' option to diff. However, commit af2f368091
> >> defines that option thus:
> >>
> >> +               { OPTION_CALLBACK, 0, "output", options, N_("<file>"),
> >> +                 N_("Output to a specific file"),
> >> +                 PARSE_OPT_NONEG, NULL, 0, diff_opt_output },
> >>
> >> Note that the 'option type' is given as OPTION_CALLBACK, not
> >> as OPTION_LOWLEVEL_CALLBACK. Is this intended?
> >
> > Yeah I think this is correct (phew!).
>
> OK, I just had a look at the code in parse-options.c.
> Hmm, somewhat ugly! :-D

Yeah it's a bit hackish. The problem is parse-options (and also config
parser) does not allow passing user data to the callback. Changing it
would affect all callsites at once. It's just too scary for me to do
it and I chose an uglier way but with smaller impact.
-- 
Duy

  reply	other threads:[~2019-05-24  9:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 19:56 Incorrect diff-parseopt conversion? Ramsay Jones
2019-05-22  0:11 ` Duy Nguyen
2019-05-22  0:35   ` Ramsay Jones
2019-05-24  9:40     ` Duy Nguyen [this message]
2019-05-24 10:08       ` Ævar Arnfjörð Bjarmason
2019-05-25 10:37         ` Duy Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACsJy8AzY4EO_io_8R41uVDsbCj+_Fn8YOQ8e+JmAC27dFW7UA@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ramsay@ramsayjones.plus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).