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

Re: [feature request] git add completion should exclude staged content

From
Manlio Perillo <manlio.perillo@gmail.com>
Date
Jan 30, 2013, 19:58 UTC
Message-ID
<51097B49.6070301@gmail.com>
In-Reply-To
<E59706EF8DB1D147B15BECA3322E4BDC097E39@eusaamb103.ericsson.se>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Il 30/01/2013 19:55, Marc Khouzam ha scritto:
Show 18 quoted lines
> [...]
>>>> The new logic in git-completion.bash tells bash that 'filenames'
>>>> completion is ongoing so bash will add a '/' after directories.
>>>> Sadly, tcsh won't do that, so it would be simpler if
>>>> git-completion.bash added the '/' itself.  I looked at the 
>>>> git-completion.bash script changes and I noticed that for 
>>>> bash version < 4, you have to add the '/' yourself.
> 
> The compatible version is not only required for Bash; you can 
> use it for
> other shells.
> 
> Try to redefine the __git_index_file_list_filter function to use the
> version that adds a slash to directory names.
> 
>> I hadn't thought of that!
>> Although I would prefer not to have special cases like that,
>> it does work well.

The zsh compatible code does something like this; this is the reason I tried to do the same thing, in order to keep coding consistent.

Show 23 quoted lines
> [...]
>
> Bash 4.1.5(1) always adds an additional slash for directories.
> I have tested it right now: change the filter function to use the
> compatible version:
> 
> __git_index_file_list_filter ()
> {
> 	# Default to Bash >= 4.x
> 	__git_index_file_list_filter_compat
> }
> 
> 
> Then running `git add <TAB>` inside the git repository, I get 
> this file
> completion list:
> 
> $ git add <TAB>
> contrib//
> 
>> Ok, I see.  The double-slash is visible in the completion list
>> but it does not appear on the command-line when bash automatically
>> adds it.

Right; that's why I wrote in the comment that Bash behaviour "seems" stupid. But probably that comment should be remove or changed for the final version of the patch; I'll leave that to a Bash expert.

> [...]
Regards  Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlEJe0kACgkQscQJ24LbaUScGgCeMDDdprJMgnYtFzqnFQamhfvU BikAniMkwbOEVkkomOd9G0m3KY44f/9O =c8rC -----END PGP SIGNATURE-----

Previous: Marc KhouzamNext: Manlio Perillo
Message 12 of 13 in “[feature request] git add completion should exclude staged content”
  1. wookietreiberJan 26, 2013
  2. Junio C HamanoJan 27, 2013
  3. Manlio PerilloJan 28, 2013
  4. Michael J GruberJan 28, 2013
  5. Manlio PerilloJan 28, 2013
  6. Michael J GruberJan 28, 2013
  7. Junio C HamanoJan 28, 2013
  8. Manlio PerilloJan 28, 2013
  9. Marc KhouzamJan 30, 2013
  10. Manlio PerilloJan 30, 2013
  11. Marc KhouzamJan 30, 2013
  12. Manlio PerilloJan 30, 2013
  13. Manlio PerilloJan 28, 2013

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.