From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Rolf Leggewie <foss@rolf.leggewie.biz>
Cc: git@vger.kernel.org
Subject: Re: broken bash completion
Date: Sat, 5 May 2012 01:32:13 +0200 [thread overview]
Message-ID: <20120504233213.GF2164@goldbirke> (raw)
In-Reply-To: <4FA14016.8050503@rolf.leggewie.biz>
Hi,
On Wed, May 02, 2012 at 10:09:26PM +0800, Rolf Leggewie wrote:
> Current bash completion works the following way.
>
> 1) only tag-completion possible: complete tag as much as possible
> 2) only file/dir-completion possible: complete path as much as possible
> 3) all of tag/file/dir-completion possible: complete tag (!) as much
> as possible
>
> 1 and 2 are fine, but for #3 git should really stop at the lowest
> common denominator for all of tags, files and directories. This is
> explained better in above tickets, but I'll also include an example
> here for illustration. Let's say I had tags debian/1.4.9-1 and
> debian/1.4.9-2 as well as debian/changelog file (as is common when
> using git-buildpackage, this is a real life example). Current
> bash-completion behavior for "git log debiTAB" is to complete to
> "git log debian/1.4.9-"
Yeah, there are a lot of git commands that accept refs (not just tags)
and files as well. When completing a non-option word (i.e. a word
that does not begin with a double dash) for such a command, git's
completion script offers only refs, but when none of the refs matches
the word to be completed, then COMPREPLY remains empty and Bash falls
back to the default filename completion.
Now, to resolve ambiguity between options/refs and paths, the '--'
separator should be used before the first path to separate options and
refs from paths. The completion script recognizes this separator, and
lets Bash perform filename completion for subsequent words. So if you
know that you want to complete a file, then 'git log -- d<TAB>' will
give you 'debian/'. Alternatively, you can just prefix './' to the
path, e.g. write 'git log ./d<TAB>' to get './debian/'.
> when it really should be "git log debian/".
I understand why you think that offering 'debian/' there would be the
correct behavior. However, in this case being correct is perhaps not
the right thing. Currently 'git log c<TAB>' offers me a couple of
completion-related branches, but with your correct behavior that would
be cluttered by all files and directories starting with 'c'. I for
one would find that inconvenient and annoying, especially because,
while there are easy ways to get filename completion instead of refs,
as shown above, there is no similarly easy way to get only refs
completion.
Best,
Gábor
next prev parent reply other threads:[~2012-05-04 23:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-02 14:09 broken bash completion Rolf Leggewie
2012-05-04 23:32 ` SZEDER Gábor [this message]
2012-05-05 4:24 ` Rolf Leggewie
2012-05-05 12:13 ` SZEDER Gábor
2012-05-05 12:22 ` Andreas Schwab
2012-05-05 13:11 ` Felipe Contreras
2012-05-05 13:57 ` fREW Schmidt
2012-05-05 14: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=20120504233213.GF2164@goldbirke \
--to=szeder@ira.uka.de \
--cc=foss@rolf.leggewie.biz \
--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).