Re: [PATCH v2 02/10] merge: simplify parsing of "-n" option
- From
Jeff King <peff@peff.net>
- Date
- Sep 5, 2023, 06:43 UTC
- Message-ID
- <20230905064307.GA199565@coredump.intra.peff.net>
- In-Reply-To
- <75100a68-78d1-b22c-0497-36548c518b7b@web.de>
On Sat, Sep 02, 2023 at 08:20:28AM +0200, René Scharfe wrote:
Show 16 quoted lines
> > static struct option builtin_merge_options[] = {
> > - OPT_CALLBACK_F('n', NULL, NULL, NULL,
> > - N_("do not show a diffstat at the end of the merge"),
> > - PARSE_OPT_NOARG, option_parse_n),
> > + OPT_SET_INT('n', NULL, &show_diffstat,
> > + N_("do not show a diffstat at the end of the merge"), 0),
> > OPT_BOOL(0, "stat", &show_diffstat,
> > N_("show a diffstat at the end of the merge")),
>
> Makes it easier to see that we can replace the two complementary
> definitions with a single one:
>
> OPT_NEGBIT('n', "no-stat",
> N_("do not show a diffstat at the end of the merge"), 1),
>
> Which is a separate topic, of course. And if we did that, however, ...Ah, I thought we had a "reverse bool" of some kind, but I couldn't find it. NEGBIT was what I was looking for. But yeah, I agree it gets more complicated with the various aliases. I think what I have here is a good stopping point for this series, but if you want to go further on it, be my guest. :)
-Peff