Re: [PATCH 5/5] completion: fix completion of certain aliases
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Apr 9, 2014, 20:36 UTC
- Message-ID
- <5345af56dec8c_537810af310b9@nysa.notmuch>
- In-Reply-To
- <xmqqa9bu1enk.fsf@gitster.dls.corp.google.com>
Junio C Hamano wrote:
Show 17 quoted lines
> Felipe Contreras <felipe.contreras@gmail.com> 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 <aymeric.beaumet@gmail.com> > > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> > > --- > > 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<tab>
-- Felipe Contreras