]> git.ipfire.org Git - thirdparty/git.git/commitdiff
completion: bash: fix late declaration of __git_cmd_idx
authorFabian Wermelinger <fabianw@mavt.ethz.ch>
Fri, 18 Jun 2021 14:02:57 +0000 (16:02 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 19 Jun 2021 06:30:35 +0000 (15:30 +0900)
A recent update to contrib/completion/git-completion.bash causes bash to fail
auto complete custom commands that are wrapped with __git_func_wrap. Declaring
__git_cmd_idx=0 inside __git_func_wrap resolves the issue.

Signed-off-by: Fabian Wermelinger <fabianw@mavt.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash

index 7bce9a0112f7dcfe2b00e512058fb2ed0231746d..7b1bbb90ce338d96a5ed46a79e681adb51c4021f 100644 (file)
@@ -3506,6 +3506,7 @@ fi
 __git_func_wrap ()
 {
        local cur words cword prev
+       local __git_cmd_idx=0
        _get_comp_words_by_ref -n =: cur words cword prev
        $1
 }