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

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

From
Manlio Perillo <manlio.perillo@gmail.com>
Date
Dec 18, 2012, 16:25 UTC
Message-ID
<50D09908.6020007@gmail.com>
In-Reply-To
<7vzk1clb3n.fsf@alter.siamese.dyndns.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Il 17/12/2012 20:42, Junio C Hamano ha scritto:
Show 13 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/.
> 

The patch is ready, however I decided to leave git mv completion simple. Pressing <TAB> will always try to autocomplete using all cached files. I have added a note to remember it needs more work.

P.S.: git-completion.bash has a lot of other things that may be improved:

* adding missing commands
 (as an example, there is strangely no custom support fot "git status")
* completion support for commands like "git checkout" is not complete.
  "git checkout <TAB>" will correctly try to complete the tree-ish,
  however "git checkout HEAD -- <TAB>" will try to complete the path
  using *all* files in the working directory.
  This is easy to fix, using the new functions I have added
* not all long options are supported.
  The script documentation says that only common long options are
  supported, so I'm not sure it is ok to add support for all available
  long options.
Regards   Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlDQmQgACgkQscQJ24LbaUSw9QCfT1lCH/yjA4Lgmb2nMspNWM3l hMMAn26UxWesuoOxMbuwhqaypPjkmN84 =Wh4c -----END PGP SIGNATURE-----

Previous: Junio C HamanoNext: Manlio Perillo
Message 5 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.