[PATCH] completion: fix __git_cmd_idx regression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The commit 59d85a2a05 (git-completion.bash: use $__git_cmd_idx in more
places, 2021-04-22) caused a regression when using __git_complete and a
command relies on __git_cmd_idx.

We need the function wrapper to define __git_cmd_idx.

Reported-by: Harrison McCullough <mccullough.harrison@xxxxxxxxx>
Helped-by: Fabian Wermelinger <fabianw@xxxxxxxxxxxx>
Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
---
 git-completion.bash | 2 +-
 git-completion.zsh  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-completion.bash b/git-completion.bash
index b50c5d0..c053a62 100644
--- a/git-completion.bash
+++ b/git-completion.bash
@@ -3511,7 +3511,7 @@ fi
 
 __git_func_wrap ()
 {
-	local cur words cword prev
+	local cur words cword prev __git_cmd_idx=0
 	_get_comp_words_by_ref -n =: cur words cword prev
 	$1
 }
diff --git a/git-completion.zsh b/git-completion.zsh
index cac6f61..a1f2d27 100644
--- a/git-completion.zsh
+++ b/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]}
-- 
2.32.0




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux