summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2020-10-28 02:06:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-10-28 21:30:59 (GMT)
commit81f717bb268e86eee5701b8199d8f030938a184c (patch)
treecfd2719d1c84218b66d893ed6481975f2c9852c1 /contrib/completion
parentea625a39fe5dfcaa3df0d1ee53a40008213acd59 (diff)
downloadgit-81f717bb268e86eee5701b8199d8f030938a184c.zip
git-81f717bb268e86eee5701b8199d8f030938a184c.tar.gz
git-81f717bb268e86eee5701b8199d8f030938a184c.tar.bz2
completion: zsh: fix for command aliasing
A lot of people want to define aliases like gc='git commit', and zsh allows that (when not using 'complete_aliases'), but we need to handle services that call a function other than the main one. With this patch we can do: compdef _git gc=git_commit Additionally, add compatibility for Zsh Git functions which have the form git-commit (with dash, not underscore). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion')
-rw-r--r--contrib/completion/git-completion.zsh6
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index ccf384b..f524c60 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -243,8 +243,12 @@ _git ()
if (( $+functions[__${service}_zsh_main] )); then
__${service}_zsh_main
- else
+ elif (( $+functions[__${service}_main] )); then
emulate ksh -c __${service}_main
+ elif (( $+functions[_${service}] )); then
+ emulate ksh -c _${service}
+ elif (( $+functions[_${service//-/_}] )); then
+ emulate ksh -c _${service//-/_}
fi
let _ret && _default && _ret=0