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

Re: [PATCH] completion: fix __gitcomp_builtin no longer consider extra options

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Oct 22, 2018, 17:49 UTC
Message-ID
<20181022174944.GH30222@szeder.dev>
In-Reply-To
<CACsJy8B-NtKb1sk_CxwB-bffMsy+nDGL2-MpkScBF5vvGHFBjA@mail.gmail.com>
On Mon, Oct 22, 2018 at 04:34:16PM +0200, Duy Nguyen wrote:
Show 30 quoted lines
> On Mon, Oct 22, 2018 at 5:51 AM Junio C Hamano <gitster@pobox.com> wrote:
> >
> > Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
> >
> > > __gitcomp_builtin() has the main completion list provided by
> > >
> > >     git xxx --git-completion-helper
> > >
> > > but the caller can also add extra options that is not provided by
> > > --git-completion-helper. The only call site that does this is "git
> > > difftool" completion.
> > >
> > > This support is broken by b221b5ab9b (completion: collapse extra
> > > --no-.. options - 2018-06-06), which adds a special value "--" to mark
> > > that the rest of the options can be hidden by default. The commit
> > > forgets the fact that extra options are appended after
> > > "$(git xxx --git-completion-helper)", i.e. after this "--", and will
> > > be incorrectly hidden as well.
> > >
> > > Prepend the extra options before "$(git xxx --git-completion-helper)"
> > > to avoid this.
> >
> > Thanks for a clear analysis.  How did you find it?  Got annoyed that
> > completion of difftool got broken, or discovered while trying to
> > apply the same trick as difftool completion uses to another one and
> > seeing that the technique does not work?
> 
> I was fixing format-patch completion and was surprised it did not work
> as expected. Never really used difftool myself :P I only found out
> about it when I asked myself "why wasn't this breakage found earlier?"

Erm... maybe because there are no tests covering the combination of extra options and '--no-..' options in 't9902-completion.sh'?

(Hint, hint... :)
Previous: Duy Nguyen
Message 4 of 4 in “completion: fix __gitcomp_builtin no longer consider extra options”
  1. completion: fix __gitcomp_builtin no longer consider extra optionsNguyễn Thái Ngọc Duy, Oct 21, 2018
  2. Junio C HamanoOct 22, 2018
  3. Duy NguyenOct 22, 2018
  4. SZEDER GáborOct 22, 2018

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.