git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: David Aguilar <davvid@gmail.com>, Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org,
	"Felipe Contreras" <felipe.contreras@gmail.com>,
	"Denton Liu" <liu.denton@gmail.com>,
	"SZEDER Gábor" <szeder.dev@gmail.com>
Subject: RE: [PATCH v2] contrib/completion: fix zsh completion regression from 59d85a2a05
Date: Sun, 30 May 2021 11:52:39 -0500	[thread overview]
Message-ID: <60b3c2d7557bd_be762089a@natae.notmuch> (raw)
In-Reply-To: <20210530062438.53527-1-davvid@gmail.com>

David Aguilar wrote:
> --- 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

      reply	other threads:[~2021-05-30 16:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-30  6:24 [PATCH v2] contrib/completion: fix zsh completion regression from 59d85a2a05 David Aguilar
2021-05-30 16:52 ` Felipe Contreras [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60b3c2d7557bd_be762089a@natae.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=liu.denton@gmail.com \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).