Subject: Re: [PATCH 1/8] merge: make xopts a strvec

From: Junio C Hamano <[email-masked]>
Date: Thu, 31 Aug 2023 08:46:25 -0700

Jeff King <[email-masked]> writes:

> The "xopts" variable uses a custom array with ALLOC_GROW(). Using a
> strvec simplifies things a bit. We need fewer variables, and we can also
> ditch our custom parseopt callback in favor of OPT_STRVEC().
>
> As a bonus, this means that "--no-strategy-option", which was previously
> a silent noop, now does something useful: like other list-like options,
> it will clear the list of -X options seen so far.
>
> Signed-off-by: Jeff King <[email-masked]>
> ---
> I guess you could argue this is a backwards-incompatible change, but the
> existing behavior of --no-strategy-option is so dumb that I can't
> believe somebody would prefer it (plus revert/cherry-pick already use
> OPT_STRVEC for their matching "-X").
>
> I didn't bother adding a test since we're just re-using OPT_STRVEC code
> that is used elsewhere.

I do not think of any useful way to have "--no-strategy-option" on
the command line (either as an early part of an alias or in a
script) that does nothing (it's not like the command requires at
least one -X option on the command line), either.  Just like
fb60b9f3 (sequencer: use struct strvec to store merge strategy
options, 2023-04-10), which met no complaints about a possible
fallout by the behaviour change, I do not think that this change
even deserves an entry in the backward compatibility notes.

We did not have strvec, let alone OPT_STRVEC(), back when the -Xopts
was invented around the Git 1.7.0 cycle.  The loss of custom xopts
code is very nice.

Thanks.