summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/completion')
-rw-r--r--contrib/completion/git-completion.bash119
1 files changed, 28 insertions, 91 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 4e724a5b76..cd1d8e553f 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -834,19 +834,33 @@ __git_complete_strategy ()
return 1
}
+# __git_commands requires 1 argument:
+# 1: the command group, either "all" or "porcelain"
__git_commands () {
- if test -n "${GIT_TESTING_COMMAND_COMPLETION:-}"
- then
- printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}"
- else
- git --list-cmds=main,others
- fi
+ case "$1" in
+ porcelain)
+ if test -n "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
+ then
+ printf "%s" "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
+ else
+ git --list-cmds=list-mainporcelain,others,list-complete
+ fi
+ ;;
+ all)
+ if test -n "$GIT_TESTING_ALL_COMMAND_LIST"
+ then
+ printf "%s" "$GIT_TESTING_ALL_COMMAND_LIST"
+ else
+ git --list-cmds=main,others
+ fi
+ ;;
+ esac
}
-__git_list_all_commands ()
+__git_list_commands ()
{
local i IFS=" "$'\n'
- for i in $(__git_commands)
+ for i in $(__git_commands $1)
do
case $i in
*--*) : helper pattern;;
@@ -855,6 +869,11 @@ __git_list_all_commands ()
done
}
+__git_list_all_commands ()
+{
+ __git_list_commands all
+}
+
__git_all_commands=
__git_compute_all_commands ()
{
@@ -864,89 +883,7 @@ __git_compute_all_commands ()
__git_list_porcelain_commands ()
{
- local i IFS=" "$'\n'
- __git_compute_all_commands
- for i in $__git_all_commands
- do
- case $i in
- *--*) : helper pattern;;
- applymbox) : ask gittus;;
- applypatch) : ask gittus;;
- archimport) : import;;
- cat-file) : plumbing;;
- check-attr) : plumbing;;
- check-ignore) : plumbing;;
- check-mailmap) : plumbing;;
- check-ref-format) : plumbing;;
- checkout-index) : plumbing;;
- column) : internal helper;;
- commit-tree) : plumbing;;
- count-objects) : infrequent;;
- credential) : credentials;;
- credential-*) : credentials helper;;
- cvsexportcommit) : export;;
- cvsimport) : import;;
- cvsserver) : daemon;;
- daemon) : daemon;;
- diff-files) : plumbing;;
- diff-index) : plumbing;;
- diff-tree) : plumbing;;
- fast-import) : import;;
- fast-export) : export;;
- fsck-objects) : plumbing;;
- fetch-pack) : plumbing;;
- fmt-merge-msg) : plumbing;;
- for-each-ref) : plumbing;;
- hash-object) : plumbing;;
- http-*) : transport;;
- index-pack) : plumbing;;
- init-db) : deprecated;;
- local-fetch) : plumbing;;
- ls-files) : plumbing;;
- ls-remote) : plumbing;;
- ls-tree) : plumbing;;
- mailinfo) : plumbing;;
- mailsplit) : plumbing;;
- merge-*) : plumbing;;
- mktree) : plumbing;;
- mktag) : plumbing;;
- pack-objects) : plumbing;;
- pack-redundant) : plumbing;;
- pack-refs) : plumbing;;
- parse-remote) : plumbing;;
- patch-id) : plumbing;;
- prune) : plumbing;;
- prune-packed) : plumbing;;
- quiltimport) : import;;
- read-tree) : plumbing;;
- receive-pack) : plumbing;;
- remote-*) : transport;;
- rerere) : plumbing;;
- rev-list) : plumbing;;
- rev-parse) : plumbing;;
- runstatus) : plumbing;;
- sh-setup) : internal;;
- shell) : daemon;;
- show-ref) : plumbing;;
- send-pack) : plumbing;;
- show-index) : plumbing;;
- ssh-*) : transport;;
- stripspace) : plumbing;;
- symbolic-ref) : plumbing;;
- unpack-file) : plumbing;;
- unpack-objects) : plumbing;;
- update-index) : plumbing;;
- update-ref) : plumbing;;
- update-server-info) : daemon;;
- upload-archive) : plumbing;;
- upload-pack) : plumbing;;
- write-tree) : plumbing;;
- var) : infrequent;;
- verify-pack) : infrequent;;
- verify-tag) : plumbing;;
- *) echo $i;;
- esac
- done
+ __git_list_commands porcelain
}
__git_porcelain_commands=