[RFD] minor frustration in 'git add' pathname completion

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

[RFD] minor frustration in 'git add' pathname completion

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:08:56

It seems that "git add foo<TAB>" completes to files

 (1) whose names match 'foo*',

 (2) that are not ignored (i.e. "foobar~" will not be offered for
     Emacs users), and

 (3) are different from the index.

The last one is somewhat frustrating at times.  For example, I keep
a backup version of whats-cooking.txt in the working tree that I use
to manage the 'todo' branch as whats-cooking.txt+, and this is not
explicitly "ignored".  Most of the time, I have changes to the real
file, so

    $ git add whats<TAB>

would complete to "whats-cooking.txt" (because there are two
candidates, "whats-cooking.txt" and "whats-cooking.txt+", and the
first completion is done up to the common prefix) and everything is
good.

Immediately after I did "git add whats-cooking.txt", however,
because of (3), the completion for 

    $ git add whats<TAB>

offers "whats-cooking.txt+", because that is the only candidate that
passes all three criteria.  This is quite annoying and even dangerous,
because it does not happen most of the time.

I am wondering if there is a downside to removing (3) from the
completion logic.

Discuss.

Thanks.

Re: [RFD] minor frustration in 'git add' pathname completion

From: Stefan Beller <hidden>
Date: 2016-06-15 23:08:57

On Thu, Mar 24, 2016 at 2:44 PM, Junio C Hamano [off-list ref] wrote:
Discuss.
For example, I keep
a backup version of whats-cooking.txt in the working tree that I use
to manage the 'todo' branch as whats-cooking.txt+, and this is not
explicitly "ignored".
Completely side tracking thought: Have you considered ignoring
whats-cooking.txt+ locally?

WC+ is a local thing to your repo, so you'd want to prefer
$GIT_DIR/info/exclude over .gitignore.

You wish to ignore WC+ by git, so make it be ignored,
instead of changing the git add rules. Your proposal
feels like fixing the symptoms instead of the root cause.

I can see (3) being useful as it narrows down the list
by a lot, I would imagine.

As I rarely use git add, but prefer git-gui, I have no experience though
for git-add completion, but if you had one conflict after a bad merge
you can just do git add <TAB> to get that file(?), so I guess people use it.

Stefan

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help