git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 24, 2016, 21:44 UTC
Message-ID
<xmqqr3ez7dqw.fsf@gitster.mtv.corp.google.com>
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.
Next: Stefan Beller
Message 1 of 8 in “[RFD] minor frustration in 'git add' pathname completion”
  1. Junio C HamanoMar 24, 2016
  2. Stefan BellerMar 24, 2016
  3. Junio C HamanoMar 24, 2016
  4. Junio C HamanoMar 24, 2016
  5. Stefan BellerMar 24, 2016
  6. Junio C HamanoMar 24, 2016
  7. Jacob KellerMar 25, 2016
  8. Junio C HamanoMar 24, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.