Re: [PATCH v3] completion: add new _GIT_complete helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 06, 2012 at 01:14:25PM +0200, SZEDER Gábor wrote:
> On Sat, May 05, 2012 at 05:23:20PM +0200, Felipe Contreras wrote:
> > This simplifies the completions, and makes it easier to define aliases:
> > 
> >  _GIT_complete gf git_fetch
> 
> So, 'gf' is an alias for 'git fetch', for which the user would like to
> use the completion for 'git fetch', right?  But that completion
> function is caled _git_fetch(), so the underscore prefix is missing
> here.
> 
> Besides, this example won't work, because the completion for 'git
> fetch' uses __git_complete_remote_or_refspec(), which in turn relies
> on finding out the name of the git command from the word on the
> command line, and it won't be able to do that from 'gf'.

I scanned the completion script for places where we iterate over the
words on the command line, i.e. for the pattern 'while.*\$cword'.

It seems that with the exception of __git_complete_remote_or_refspec()
all those places seem to be OK to be used with aliases.  They all
start the iteration at the first word on the command line ('git' or
'gf' being the nullth) so they will iterate over all relevant words in
case of aliases, too.  Perhaps this is a heritage of the dashed
commands; back then the completion script had to deal with 'git cmd'
and 'git-cmd', too.  __git_complete_remote_or_refspec() starts at the
second word, so that must be changed.


Best,
Gábor

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]