git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dimi via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Dimi <dimitar+github@pagerduty.com>,
	Dimitar Roustchev <dimitar+github@pagerduty.com>
Subject: [PATCH] contrib/completion: fix zsh completion regression
Date: Thu, 27 Apr 2023 05:27:22 +0000	[thread overview]
Message-ID: <pull.1499.git.git.1682573243090.gitgitgadget@gmail.com> (raw)

From: Dimitar Roustchev <dimitar+github@pagerduty.com>

From: Felipe Contreras <felipe.contreras@gmail.com> @ 2021-08-16  9:19 UTC
[1]

Despite 0b18023 addressing a regression from 59d85a2, the issue
described in [1] still persists as described:

  compdef _git ga=git-add
  ga <tab>
  ga __git_find_on_cmdline:[:16: unknown condition: -lt

The suggested fix to set __git_cmd_idx for the _git function wrapper
worked for me on:

- zsh v5.8.1
- git v2.40.1

Signed-off-by: Dimitar Roustchev <dimitar@pagerduty.com>

[1] https://lore.kernel.org/all/20210816091935.548555-1-felipe.contreras@gmail.com/
---
    contrib/completion: fix zsh completion regression
    
    Despite 0b18023 addressing a regression from 59d85a2, the issue
    described in
    https://lore.kernel.org/all/20210816091935.548555-1-felipe.contreras@gmail.com/T/
    still persists as described:
    
    compdef _git ga=git-add ga ga __git_find_on_cmdline:[:16: unknown
    condition: -lt
    
    The suggested fix to set __git_cmd_idx for the _git function wrapper
    worked for me on:
    
     * zsh v5.8.1
     * git v2.40.1

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1499%2Fdroustchev-pd%2Ffix-__git_cmd_idx-regression-zsh-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1499/droustchev-pd/fix-__git_cmd_idx-regression-zsh-v1
Pull-Request: https://github.com/git/git/pull/1499

 contrib/completion/git-completion.zsh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index cac6f618817..a1f2d278179 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -271,7 +271,7 @@ __git_zsh_main ()
 _git ()
 {
 	local _ret=1
-	local cur cword prev
+	local cur cword prev __git_cmd_idx=0
 
 	cur=${words[CURRENT]}
 	prev=${words[CURRENT-1]}

base-commit: 2807bd2c10606e590886543afe4e4f208dddd489
-- 
gitgitgadget

                 reply	other threads:[~2023-04-27  5:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=pull.1499.git.git.1682573243090.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=dimitar+github@pagerduty.com \
    --cc=git@vger.kernel.org \
    /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).