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