completion: fix completing args of aliased "push", "fetch", etc.
commit880111c11befaaf070e8ea1021bf11b4fb58c461
authorFelipe Contreras <felipe.contreras@gmail.com>
Wed, 9 Apr 2014 18:50:04 +0000 (9 13:50 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Apr 2014 21:22:18 +0000 (9 14:22 -0700)
treeb823cf2a33d9f1115996cdccb346d08e2bc37e62
parent68773ac915580e88016c34ce1269730382b501d4
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>
contrib/completion/git-completion.bash
contrib/completion/git-completion.zsh