From: Jonathan Nieder <jrnieder@gmail.com>
To: Ping Yin <pkufranky@gmail.com>
Cc: "git mailing list" <git@vger.kernel.org>,
"Felipe Contreras" <felipe.contreras@gmail.com>,
"Manlio Perillo" <manlio.perillo@gmail.com>,
"Marc Khouzam" <marc.khouzam@gmail.com>,
"SZEDER Gábor" <szeder@ira.uka.de>
Subject: Re: How to setup bash completion for alias of git command
Date: Sun, 20 Jan 2013 03:14:24 -0800 [thread overview]
Message-ID: <20130120111424.GG16339@elie.Belkin> (raw)
In-Reply-To: <CACSwcnQu8Rx83mcGYR6NGzEhoreNR6DfiK876LF7pa9PGm30JA@mail.gmail.com>
Hi Ping,
Ping Yin wrote:
> Following setup works for me in ubuntu (10.04,11.04) for a long time
>
> alias gtlg='git log'
> complete -o default -o nospace -F _git_log gtlg
>
> However, in debian (testing, wheezy), it doesn't work
>
> $ gtlg or<TAB>
> gtlg or-bash: [: 1: unary operator expected
> -bash: [: 1: unary operator expected
Yes, I can reproduce this. "git bisect" tells me it was introduced
by v1.7.6-rc0~65^2~4 (completion: remove unnecessary
_get_comp_words_by_ref() invocations, 2011-04-28). Since then, Felipe
has done work to make reusing subcommand completion easy again, so you
can do
__git_complete gtlg _git_log
One complication: on some systems, including Ubuntu 13.04, git's bash
completion script is installed to
/usr/share/bash-completion/completions/git
and sourced on the fly when completing commands starting with "git"
instead of right away from /etc/bash_completion. On these systems,
the "__git_complete" function would not be usable right away from
your .bashrc file. I think we should fix this, for example by moving
the function to a separate
$(git --exec-path)/git-bashrc-functions
library.
Thanks for reporting,
Jonathan
next prev parent reply other threads:[~2013-01-20 11:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-12 14:30 How to setup bash completion for alias of git command Ping Yin
2013-01-13 3:13 ` Ping Yin
2013-01-20 11:14 ` Jonathan Nieder [this message]
2013-01-21 3:55 ` Ping Yin
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=20130120111424.GG16339@elie.Belkin \
--to=jrnieder@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=manlio.perillo@gmail.com \
--cc=marc.khouzam@gmail.com \
--cc=pkufranky@gmail.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).