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 <szeder.dev@gmail.com> Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Todd Zullinger committed Mar 20, 2019 at 14:03 UTC 2eb6f09f7d9c02266f7e6ac8b1591abc8b10278d
1 file changed +4 -4
contrib/completion/git-completion.bash
+4 -4
@@ -1024,7 +1024,7 @@ __git_all_commands=
1024 __git_compute_all_commands ()
1025 {
1026 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)
1028 }
1029
1030 # Lists all set config variables starting with the given section prefix,
@@ -1652,9 +1652,9 @@ _git_help ()
1652 esac
1653 if test -n "$GIT_TESTING_ALL_COMMAND_LIST"
1654 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"
1656 else
1657 - __gitcomp "$(git --list-cmds=main,nohelpers,alias,list-guide) gitk"
1657 + __gitcomp "$(__git --list-cmds=main,nohelpers,alias,list-guide) gitk"
1658 fi
1659 }
1660
@@ -2925,7 +2925,7 @@ __git_main ()
2925 then
2926 __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
2927 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)"
2929 fi
2930 ;;
2931 esac