git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shawn Pearce <spearce@spearce.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Calling all bash completion experts..
Date: Sat, 25 Nov 2006 02:13:51 -0500	[thread overview]
Message-ID: <20061125071351.GE4528@spearce.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0611230935520.27596@woody.osdl.org>

Linus Torvalds <torvalds@osdl.org> wrote:
> So I do "git repa<tab>" and get "git repack", which is fine, but I really 
> _wanted_ to get "git repack " (with the space at the end), since I've now 
> got a unique command, and that's the normal completion behaviour (ie I 
> want it to act the same way that "git-repa<tab>" would have acted).
[snip]
> Now, without knowing the completion syntax, I assume it's the "-o nospace" 
> things in the completion file. So I'm wondering _why_ that "nospace" is 
> there, and whether this could be fixed?

Yes, its the "-o nospace".

I added the nospace option because of the completion for fetch/push,
cat-file, diff-tree and ls-tree.

The problem is the file completion for e.g. cat-file.  We don't
want a space added after we complete a directory name, so you can
complete further, e.g.:

  git cat-file -p ma<tab>con<tab>comp<tab>git-com<tab>

gives us:

  git cat-file -p master:contrib/completion/git-completion.sh

but if I omitted the "-o nospace" then we would instead need:

  git cat-file ma<tab><bs>con<tab><bs>comp<tab><bs>git-com<tab>

as each successive <tab> would add a trailing space that you would need
to remove before you can complete again.

So as a user I decided that adding the space myself was less
annoying then needing to delete the space during completion down
through a tree.  But perhaps that was wrong.

I did try to inject the space myself in the completion code when
I knew something was unique, but bash didn't like that (it tossed
the space).

To be honest, I'm not really sure how to fix it.

One option would be to perform a `ls-tree -r` through whatever part
of the path we have now and offer up EVERYTHING in the tree as a
possible completion, but that is insane as it will take a little
while to generate and on a large tree (e.g. the Linux kernel) you
will get a large number of proposed completions back which aren't
really relevant.

-- 

  reply	other threads:[~2006-11-25  7:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-23 17:45 Calling all bash completion experts Linus Torvalds
2006-11-25  7:13 ` Shawn Pearce [this message]
2006-11-25 19:08   ` Linus Torvalds
2006-11-26  4:03     ` Shawn Pearce

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=20061125071351.GE4528@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.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).