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

RE: [PATCH v2] contrib/completion: fix zsh completion regression from 59d85a2a05

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 30, 2021, 16:52 UTC
Message-ID
<60b3c2d7557bd_be762089a@natae.notmuch>
In-Reply-To
<20210530062438.53527-1-davvid@gmail.com>
David Aguilar wrote:
Show 11 quoted lines
> --- a/contrib/completion/git-completion.zsh
> +++ b/contrib/completion/git-completion.zsh
> @@ -251,7 +251,7 @@ __git_zsh_main ()
>  		done
>  		;;
>  	(arg)
> -		local command="${words[1]}" __git_dir
> +		local command="${words[1]}" __git_dir __git_cmd_idx=1
>  
>  		if (( $+opt_args[--bare] )); then
>  			__git_dir='.'

Note that this is not the correct fix, since the index of the command will not always be 1.

We would probably need to at least do something like:
--- a/git-completion.zsh
+++ b/git-completion.zsh
@@ -260,7 +260,7 @@ __git_zsh_main ()
 
                (( $+opt_args[--help] )) && command='help'
 
-               words=( ${orig_words[@]} )
+               words=( git ${words[@]} )
 
                __git_zsh_bash_func $command
                ;;

And then it will almost always do the correct thing (at least in
git-completion[1] which does have all the git main arguments).

For now doing __git_cmd_idx=1 should fix the regression.

Cheers.

[1] https://github.com/felipec/git-completion
-- 
Felipe Contreras
Previous: David Aguilar
Message 2 of 2 in “contrib/completion: fix zsh completion regression from 59d85a2a05”
  1. contrib/completion: fix zsh completion regression from 59d85a2a05David Aguilar, May 30, 2021
  2. Felipe ContrerasMay 30, 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.