summaryrefslogtreecommitdiffstats
path: root/contrib/completion/git-completion.zsh
diff options
context:
space:
mode:
authorDavid Aguilar <davvid@gmail.com>2021-06-01 22:52:29 +0200
committerJunio C Hamano <gitster@pobox.com>2021-06-02 05:49:40 +0200
commit0b18023d000ed8c0851a025fcd4fd518cb2df673 (patch)
tree2e87a035530544cf7a9fd019602a52a9f0b25c52 /contrib/completion/git-completion.zsh
parentMerge branch 'ab/fsck-api-cleanup' (diff)
downloadgit-0b18023d000ed8c0851a025fcd4fd518cb2df673.tar.xz
git-0b18023d000ed8c0851a025fcd4fd518cb2df673.zip
contrib/completion: fix zsh completion regression from 59d85a2a05
A recent change to make git-completion.bash use $__git_cmd_idx in more places broke a number of completions on zsh because it modified __git_main but did not update __git_zsh_main. Notably, completions for "add", "branch", "mv" and "push" were broken as a result of this change. In addition to the undefined variable usage, "git mv <tab>" also prints the following error: __git_count_arguments:7: bad math expression: operand expected at `"1"' _git_mv:[:7: unknown condition: -gt Remove the quotes around $__git_cmd_idx in __git_count_arguments and set __git_cmd_idx=1 early in __git_zsh_main to fix the regressions from 59d85a2a05. This was tested on zsh 5.7.1 (x86_64-apple-darwin19.0). Suggested-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: David Aguilar <davvid@gmail.com> Acked-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion/git-completion.zsh')
-rw-r--r--contrib/completion/git-completion.zsh2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 6c56296997..cac6f61881 100644
--- 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='.'