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

Re: [PATCH] git-completion.bash: add support for path completion

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 17, 2012, 19:42 UTC
Message-ID
<7vzk1clb3n.fsf@alter.siamese.dyndns.org>
In-Reply-To
<50CEFF3A.4050802@gmail.com>
Manlio Perillo <manlio.perillo@gmail.com> writes:
Show 10 quoted lines
>> As long as all of the above stops completion at directory boundary,
>> I think the above sounds like a sensible thing to do.  e.g. when
>> "ls-files" gives Documentation/Makefile and Documentation/git.txt,
>> "git cmd Doc<TAB>" first would give "git cmd Documentation/" and
>> then the second <TAB> would offer these two paths as choices.  That
>> way, the user can choose to just execute "git cmd Documentation/"
>> without even looking at these individual paths.
>
> Right, this is what bash usually do.
> However I don't know how to implement this with git.
That sounds like a regression to me.
Show 6 quoted lines
>> I am not sure how you would handle the last parameter to "git mv",
>> though.  That is by definition a path that does not exist,
>> i.e. cannot be completed.
>
> Right, the code should be changed.
> No completion should be done for the second parameter.
I deliberately wrote "the last" not "the second", as you can do
	$ mkdir X
        $ git mv COPYING README X/.

You do need to expand the second parameter to README when the user types

	git mv COPYING REAMDE X

then goes back with \C-b to "M", types \C-d three times to remove "MDE", and then finally says <TAB>, to result in

	git mv COPYING README X
Previous: Manlio PerilloNext: Manlio Perillo
Message 4 of 8 in “git-completion.bash: add support for path completion”
  1. git-completion.bash: add support for path completionManlio Perillo, Dec 16, 2012
  2. Junio C HamanoDec 17, 2012
  3. Manlio PerilloDec 17, 2012
  4. Junio C HamanoDec 17, 2012
  5. Manlio PerilloDec 18, 2012
  6. Manlio PerilloDec 19, 2012
  7. Junio C HamanoDec 19, 2012
  8. Manlio PerilloDec 19, 2012

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.