diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-02-18 03:25:05 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-02-18 03:25:06 +0300 |
commit | 037dbe8ed79fab357b7a183d032b08b4ec22e5e8 (patch) | |
tree | f155a23e0e7763905fbfd043f37195b5fbc10885 /contrib/completion | |
parent | 6cfe518967ab0ffd5e5f1a84d2495afea2213dcf (diff) | |
parent | d9f88dd8bbf5302256ece5e3c50a1d3d59d2cd0e (diff) |
Merge branch 'ab/complete-show-all-commands'
The command line completion script (in contrib/) learned to
complete all Git subcommands, including the ones that are normally
hidden, when GIT_COMPLETION_SHOW_ALL_COMMANDS is used.
* ab/complete-show-all-commands:
completion: add a GIT_COMPLETION_SHOW_ALL_COMMANDS
completion tests: re-source git-completion.bash in a subshell
Diffstat (limited to 'contrib/completion')
-rw-r--r-- | contrib/completion/git-completion.bash | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 23e4c90890..49a328aa8a 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -49,6 +49,11 @@ # and git-switch completion (e.g., completing "foo" when "origin/foo" # exists). # +# GIT_COMPLETION_SHOW_ALL_COMMANDS +# +# When set to "1" suggest all commands, including plumbing commands +# which are hidden by default (e.g. "cat-file" on "git ca<TAB>"). +# # GIT_COMPLETION_SHOW_ALL # # When set to "1" suggest all options, including options which are @@ -3483,7 +3488,13 @@ __git_main () then __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST" else - __gitcomp "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)" + local list_cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config + + if test "${GIT_COMPLETION_SHOW_ALL_COMMANDS-}" = "1" + then + list_cmds=builtins,$list_cmds + fi + __gitcomp "$(__git --list-cmds=$list_cmds)" fi ;; esac |