Re: git commit file completion recently broke
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Dec 7, 2017, 08:14 UTC
- Message-ID
- <CAP8UFD3iL_sRgvhm7YO_jVG5RiNn1=JRW0qvhBEPcUtCorWdYA@mail.gmail.com>
- In-Reply-To
- <20171207005639.GB1975@sigill.intra.peff.net>
On Thu, Dec 7, 2017 at 1:56 AM, Jeff King <peff@peff.net> wrote:
Show 11 quoted lines
> I think we'd do better to just assign NULL when there's "=", so we can
> tell the difference between "--relative", "--relative=", and
> "--relative=foo" (all of which are distinct).
>
> I think that's possible with the current scheme by doing:
>
> else if (skip_to_optional_val_default(arg, "--relative", &arg, NULL)) {
> options->flags.relative_name = 1;
> if (arg)
> options->prefix = arg;
> }Yeah, that is a possible fix.
> IOW, the problem isn't in the design of the skip function, but just how > it was used in this particular case.
I agree.
Show 8 quoted lines
> I do think it may make sense for > the "short" one to use NULL, like: > > skip_to_optional_val(arg, "--relative, &arg) > > but maybe some other callers would be more inconvenienced (they may have > to current NULL back into the empty string if they want to string > "--foo" the same as "--foo=").
I discussed that with Junio and yeah there are many callers that want "--foo" to be the same as "--foo=".
By the way I wonder if "--relative=" makes any sense, and if we should emit a warning or just die in this case.