git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git commit file completion recently broke

From
Jacob Keller <jacob.keller@gmail.com>
Date
Dec 7, 2017, 18:57 UTC
Message-ID
<CA+P7+xrhgbcogxYa38jEu3PuF5hVNNYPjAq031bYE8bgao168Q@mail.gmail.com>
In-Reply-To
<xmqq8teeftn7.fsf@gitster.mtv.corp.google.com>
On Thu, Dec 7, 2017 at 7:24 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 19 quoted lines
> Christian Couder <christian.couder@gmail.com> 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

Previous: Junio C Hamano
Message 13 of 13 in “git commit file completion recently broke”
  1. Jacob KellerDec 6, 2017
  2. Jacob KellerDec 7, 2017
  3. Jacob KellerDec 7, 2017
  4. Jeff KingDec 7, 2017
  5. Jeff KingDec 7, 2017
  6. Jacob KellerDec 7, 2017
  7. Jeff KingDec 7, 2017
  8. Jacob KellerDec 7, 2017
  9. Jeff KingDec 7, 2017
  10. Christian CouderDec 7, 2017
  11. Jeff KingDec 7, 2017
  12. Junio C HamanoDec 7, 2017
  13. Jacob KellerDec 7, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.