aboutsummaryrefslogtreecommitdiff
path: root/contrib/completion/git-completion.bash
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-09-29 09:04:15 -0700
committerJunio C Hamano <gitster@pobox.com>2023-09-29 09:04:15 -0700
commitd15f92e3791d481ae244cb1436da06fe89479641 (patch)
treef3c807fba15c49aad7d520280b0f1f2791c34456 /contrib/completion/git-completion.bash
parente076f3a23f0b6a8c56389b7ad672602853a91e57 (diff)
parent8d73a2cc036199a25cc97586937267ec14cb6eae (diff)
downloadgit-d15f92e3791d481ae244cb1436da06fe89479641.tar.xz
Merge branch 'jc/alias-completion'
The command line completion script (in contrib/) can be told to complete aliases by including ": git <cmd> ;" in the alias to tell it that the alias should be completed similar to how "git <cmd>" is completed. The parsing code for the alias as been loosened to allow ';' without an extra space before it. * jc/alias-completion: completion: loosen and document the requirement around completing alias
Diffstat (limited to 'contrib/completion/git-completion.bash')
-rw-r--r--contrib/completion/git-completion.bash5
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 47fd664ea5..477ef8157a 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -28,7 +28,8 @@
# completion style. For example '!f() { : git commit ; ... }; f' will
# tell the completion to use commit completion. This also works with aliases
# of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '".
-# Be sure to add a space between the command name and the ';'.
+# Note that "git" is optional --- '!f() { : commit; ...}; f' would complete
+# just like the 'git commit' command.
#
# If you have a command that is not part of git, but you would still
# like completion, you can use __git_complete:
@@ -1183,7 +1184,7 @@ __git_aliased_command ()
:) : skip null command ;;
\'*) : skip opening quote after sh -c ;;
*)
- cur="$word"
+ cur="${word%;}"
break
esac
done