From: Jacob Keller Date: Thu, 07 Dec 2017 18:57:23 GMT Subject: Re: git commit file completion recently broke Message-ID: In-Reply-To: On Thu, Dec 7, 2017 at 7:24 AM, Junio C Hamano wrote: > Christian Couder writes: > >>> 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=". > > Yup, the original thread has details and me saying that assuming all > of them want --foo and --foo= the same is questionable. The likely > fix would be to use the _default variant with NULL, which was added > exactly for cases like this. > Slightly more complex. You have to use the _default variant, pass in arg instead of options->prefix, and then make sure arg was set before overwriting options->prefix. If you just use _default with NULL, it will not quite fix the problem. Thanks, Jake