summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2014-04-09 18:50:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-04-09 21:22:18 (GMT)
commit880111c11befaaf070e8ea1021bf11b4fb58c461 (patch)
treeb823cf2a33d9f1115996cdccb346d08e2bc37e62 /contrib/completion
parent68773ac915580e88016c34ce1269730382b501d4 (diff)
downloadgit-880111c11befaaf070e8ea1021bf11b4fb58c461.zip
git-880111c11befaaf070e8ea1021bf11b4fb58c461.tar.gz
git-880111c11befaaf070e8ea1021bf11b4fb58c461.tar.bz2
completion: fix completing args of aliased "push", "fetch", etc.
Some commands need the first word to determine the actual action that is being executed, however, the command is wrong when we use an alias, for example 'alias.p=push', if we try to complete 'git p origin ', the result would be wrong because __git_complete_remote_or_refspec() doesn't know where it came from. So let's override words[1], so the alias 'p' is override by the actual command, 'push'. Reported-by: Aymeric Beaumet <aymeric.beaumet@gmail.com> 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.bash1
-rw-r--r--contrib/completion/git-completion.zsh1
2 files changed, 2 insertions, 0 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 87de809..2c59a76 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2564,6 +2564,7 @@ __git_main ()
local expansion=$(__git_aliased_command "$command")
if [ -n "$expansion" ]; then
+ words[1]=$expansion
completion_func="_git_${expansion//-/_}"
declare -f $completion_func >/dev/null && $completion_func
fi
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 6b77968..9f6f0fa 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -104,6 +104,7 @@ __git_zsh_bash_func ()
local expansion=$(__git_aliased_command "$command")
if [ -n "$expansion" ]; then
+ words[1]=$expansion
completion_func="_git_${expansion//-/_}"
declare -f $completion_func >/dev/null && $completion_func
fi