git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Carsten Mattner <carstenmattner@googlemail.com>
Cc: Felipe Contreras <felipe.contreras@gmail.com>, git@vger.kernel.org
Subject: Re: git-completion with bash alias
Date: Fri, 18 May 2012 20:41:47 -0400	[thread overview]
Message-ID: <20120519004147.GE765@sigill.intra.peff.net> (raw)
In-Reply-To: <CACY+Hvqd6L7gWgDBvjPmLPsfA2o1CVKuqkDZ_j7XYf=WjuwvKQ@mail.gmail.com>

On Fri, May 18, 2012 at 01:35:24PM +0200, Carsten Mattner wrote:

> Completion works when used as "git checkout foo" but fails with
> "bash: [: 1: unary operator expected" when trying to complete
> via a single character shell alias like "alias g=git" as in
> "g checkout foo".
> 
> git version 1.7.10.2.548.g9de9681

Hmm. Are you invoking the completion like:

  complete -F _git g

? That used to work, but was broken by the recent 6b179ad (completion:
add new __git_complete helper, 2012-05-14).

The "new" way seems to be:

  __git_complete g _git

but that function is explicitly labeled as "not public". It looks like
there was a follow-on patch that was discussed to make a public version,
but it got dropped.

I'm not sure if this regression is intentional, or if the "old" way even
worked reliably (I seem to recall people running into issues with
_get_comp_words_by_ref not being called properly sometimes, but I don't
remember the details). So it's not clear to me if the right way forward
is fixing "complete -F _git" to work again, or if that way is just
broken, and a public version of __git_complete is the right path.

Felipe, can you comment?

-Peff

  reply	other threads:[~2012-05-19  0:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-18 11:35 git-completion with bash alias Carsten Mattner
2012-05-19  0:41 ` Jeff King [this message]
2012-05-19  2:28   ` Felipe Contreras
2012-05-19  7:50     ` Carsten Mattner
2012-05-19  7:48   ` Carsten Mattner

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=20120519004147.GE765@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=carstenmattner@googlemail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    /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).