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

Re: [PATCH v3] contrib/completion: fix zsh completion regression from 59d85a2a05

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 1, 2021, 23:33 UTC
Message-ID
<60b6c3d4d432b_4044208a6@natae.notmuch>
In-Reply-To
<CAJDDKr630n7=8FqsSRXpN7fNy9ZB8FOzO=LxvfHFVrMR1=L3_A@mail.gmail.com>
David Aguilar wrote:
Show 10 quoted lines
> On Tue, Jun 1, 2021 at 12:15 PM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> > > @@ -261,7 +261,7 @@ __git_zsh_main ()
> > >
> > >               (( $+opt_args[--help] )) && command='help'
> > >
> > > -             words=( ${orig_words[@]} )
> > > +             words=( git ${orig_words[@]} )
> >
> > This is wrong. The current code is fine.
Show 8 quoted lines
> Thanks for the detailed explanation.
> 
> Just so I'm understanding this correctly.. if this was instead..
> 
>     words=( git ${words[@]} )
> 
> (instead of orig_words like I mistakenly included in v3) would that be
> an improvement, no-op or would it be worse?

It would be an improvement, but it's orthogonal to the regression you are trying to fix.

I would just fix the regression for v2.32, and then afterwards try to do the improvement.

I have a testing framework for the zsh completion in my git-completion project, so I would be much more confident about this change if all the tests pass. Alas I have not yet merged any v2.32.0-rc* so it's not straightforward to run the tests now.

> It sounds like additional changes are needed to make it properly
> support options between "git" and the sub-command name, hence the
> patch is fine as-is in v4, correct?

I mean there's git options, and git command options. I don't know how many changes are needed to make all the interactions work correctly, but I wouldn't have confidence in any of them so close to a release, especially considering git.git doesn't have any zsh tests.

So yes, v4 is fine.
> Hopefully in the future it can be extended to cover eg. "git -c
> foo.bar -C some-dir <sub-command>" as well. Thanks for your patience.

That will work correctly on git-completion once I merge your v4 patch (and v2.32).

-- 
Felipe Contreras
Previous: David Aguilar
Message 4 of 4 in “contrib/completion: fix zsh completion regression from 59d85a2a05”
  1. contrib/completion: fix zsh completion regression from 59d85a2a05David Aguilar, Jun 1, 2021
  2. Felipe ContrerasJun 1, 2021
  3. David AguilarJun 1, 2021
  4. Felipe ContrerasJun 1, 2021

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.