From: Felipe Contreras Date: Wed, 09 Apr 2014 20:36:38 GMT Subject: Re: [PATCH 5/5] completion: fix completion of certain aliases Message-ID: <5345af56dec8c_537810af310b9@nysa.notmuch> In-Reply-To: Junio C Hamano wrote: > Felipe Contreras writes: > > > 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 come from. > > > > So let's override words[1], so the alias 'p' is override by the actual > > command, 'push'. > > > > Reported-by: Aymeric Beaumet > > Signed-off-by: Felipe Contreras > > --- > > Does "some commands" above refer to anything that uses > __git_complete_remote_or_refspec, or is the set of commands larger than that? For this particular issue, yes, the former. > But perhaps we muck with the contents of words[] in a similar way in many > different places in the existing completion code often enough that such an > attempt not to touch the words[] array does not buy us much safety anyway. I > didn't check (and that is why I am asking with "I am wondering..."). The 'words' array is already messed up and not used correctly, so I wouldn't worry too much about this patch messing it more (I don't see how that can be). For example: % git --git-dir=$PWD/.git fetch or -- Felipe Contreras