git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
	Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, "Ramkumar Ramachandra" <artagnon@gmail.com>,
	"SZEDER Gábor" <szeder@ira.uka.de>
Subject: Re: [PATCH 5/5] completion: fix completion of certain aliases
Date: Wed, 09 Apr 2014 15:36:38 -0500	[thread overview]
Message-ID: <5345af56dec8c_537810af310b9@nysa.notmuch> (raw)
In-Reply-To: <xmqqa9bu1enk.fsf@gitster.dls.corp.google.com>

Junio C Hamano wrote:
> 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

  reply	other threads:[~2014-04-09 20:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-09 18:49 [PATCH 0/5] Fixes Felipe Contreras
2014-04-09 18:50 ` [PATCH 1/5] remote-helpers: allow all tests running from any dir Felipe Contreras
2014-04-09 18:50 ` [PATCH 2/5] remote-hg: always normalize paths Felipe Contreras
2014-04-09 18:50 ` [PATCH 3/5] remote-bzr: add support for older versions Felipe Contreras
2014-04-09 18:50 ` [PATCH 4/5] remote-bzr: include authors field in pushed commits Felipe Contreras
2014-04-09 18:50 ` [PATCH 5/5] completion: fix completion of certain aliases Felipe Contreras
2014-04-09 19:33   ` Junio C Hamano
2014-04-09 20:36     ` Felipe Contreras [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-04-13  7:08 Gábor Szeder
2014-04-14 20:20 ` Junio C Hamano
2014-04-19  1:26   ` Felipe Contreras

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=5345af56dec8c_537810af310b9@nysa.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=szeder@ira.uka.de \
    /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).