From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, Jonathan Nieder <jrnieder@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
Thomas Rast <trast@student.ethz.ch>
Subject: Re: [PATCH v3] completion: add new _GIT_complete helper
Date: Sun, 6 May 2012 13:36:22 +0200 [thread overview]
Message-ID: <20120506113622.GL2164@goldbirke> (raw)
In-Reply-To: <20120506113021.GK2164@goldbirke>
On Sun, May 06, 2012 at 01:30:21PM +0200, SZEDER Gábor wrote:
> 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.
There is one more odd case, though: __git_config_get_set_variables()
iterates over the words on the command line backwards, i.e. starting
at the index $cword until the index of the word is greater than 1.
This means that the iteration will stop at the second word, so this
must be adjusted, too, just in case someone wants an alias for 'git
config'.
next prev parent reply other threads:[~2012-05-06 11:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-05 15:23 [PATCH v3] completion: add new _GIT_complete helper Felipe Contreras
2012-05-05 15:54 ` Jonathan Nieder
2012-05-05 16:38 ` Felipe Contreras
2012-05-05 16:47 ` Jonathan Nieder
2012-05-05 16:52 ` Jonathan Nieder
2012-05-05 17:20 ` Felipe Contreras
2012-05-05 17:33 ` Jonathan gives feedback --> flamewars inevitable? (Re: [PATCH v3] completion: add new _GIT_complete helper) Jonathan Nieder
2012-05-05 18:23 ` Felipe Contreras
2012-05-05 18:39 ` Jonathan gives feedback --> flamewars inevitable? Jonathan Nieder
2012-05-05 18:42 ` Jonathan Nieder
2012-05-06 5:23 ` Jonathan gives feedback --> flamewars inevitable? (Re: [PATCH v3] completion: add new _GIT_complete helper) Tay Ray Chuan
2012-05-14 9:11 ` Felipe Contreras
2012-05-05 17:44 ` [PATCH v3] completion: add new _GIT_complete helper Jonathan Nieder
2012-05-06 10:30 ` SZEDER Gábor
2012-05-06 20:47 ` Jonathan Nieder
2012-05-06 11:14 ` SZEDER Gábor
2012-05-06 11:30 ` SZEDER Gábor
2012-05-06 11:36 ` SZEDER Gábor [this message]
2012-05-06 12:12 ` SZEDER Gábor
2012-05-06 20:53 ` Felipe Contreras
2012-05-06 20:37 ` Felipe Contreras
2012-05-06 23:32 ` SZEDER Gábor
2012-05-07 0:20 ` Felipe Contreras
2012-05-07 9:22 ` SZEDER Gábor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120506113622.GL2164@goldbirke \
--to=szeder@ira.uka.de \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=trast@student.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).