Skip to content

Commit 2eb6f09

Browse files
tmzullingergitster
authored andcommitted
completion: use __git when calling --list-cmds
As we made --list-cmds read the local configuration file in an earlier step, the completion.commands variable respects repo-level configuration. Use __git which ensures that the proper repo config is consulted if the command line contains 'git -C /some/other/repo'. Suggested-by: SZEDER Gábor <[email protected]> Signed-off-by: Todd Zullinger <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 057ab54 commit 2eb6f09

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

contrib/completion/git-completion.bash

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ __git_all_commands=
10241024
__git_compute_all_commands ()
10251025
{
10261026
test -n "$__git_all_commands" ||
1027-
__git_all_commands=$(git --list-cmds=main,others,alias,nohelpers)
1027+
__git_all_commands=$(__git --list-cmds=main,others,alias,nohelpers)
10281028
}
10291029

10301030
# Lists all set config variables starting with the given section prefix,
@@ -1652,9 +1652,9 @@ _git_help ()
16521652
esac
16531653
if test -n "$GIT_TESTING_ALL_COMMAND_LIST"
16541654
then
1655-
__gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(git --list-cmds=alias,list-guide) gitk"
1655+
__gitcomp "$GIT_TESTING_ALL_COMMAND_LIST $(__git --list-cmds=alias,list-guide) gitk"
16561656
else
1657-
__gitcomp "$(git --list-cmds=main,nohelpers,alias,list-guide) gitk"
1657+
__gitcomp "$(__git --list-cmds=main,nohelpers,alias,list-guide) gitk"
16581658
fi
16591659
}
16601660

@@ -2925,7 +2925,7 @@ __git_main ()
29252925
then
29262926
__gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
29272927
else
2928-
__gitcomp "$(git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)"
2928+
__gitcomp "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)"
29292929
fi
29302930
;;
29312931
esac

0 commit comments

Comments
 (0)