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

Re: [PATCH v3] completion: add new _GIT_complete helper

From
SZEDER Gábor <szeder@ira.uka.de>
Date
May 6, 2012, 10:30 UTC
Message-ID
<20120506103006.GI2164@goldbirke>
In-Reply-To
<20120505155423.GA14684@burratino>
On Sat, May 05, 2012 at 10:54:23AM -0500, Jonathan Nieder wrote:
Show 12 quoted lines
> Felipe Contreras wrote:
> 
> > Since v3:
> >
> >  * Rename to _GIT_complete to follow bash completion "guidelines"
> >  * Get rid of foo_wrap name
> 
> Thanks.  Gábor, does the "all caps _GIT_ prefix for public API
> functions" convention look like one we should adopt?  If I understand
> correctly, previously contrib/completion/git-completion.bash used
> leading double underscores for everything except completion functions,
> so this is a change.
Dunno.  I have only three concerns:
- It doesn't contaminate "my" namespace, where my installed programs,
  aliases, and shell functions are, i.e. it begins with an underscore.
- Its name conveys that it's git-specific.
- It's not called _git_complete, so the completion script (in
  particular at the end of _git()) won't misrecognize it as a
  completion function for the 'git complete' command, just in case
  somebody ever happens to have such a command or alias.
I'm not sure about the capital letters, but it fulfills all three.
Show 22 quoted lines
> I personally would be happier with a git_complete function provided
> by another script, like this:
> 
> 	contrib/completion/git-completion.bash:
> 
> 		__git_complete () {
> 			...
> 		}
> 
> 	contrib/completion/bash-helpers.bash:
> 
> 		git_complete () {
> 			__git_complete "$@"
> 		}
> 
> One might object that if the user includes bash-helpers.bash (name is
> just a strawman) in .bashrc for interactive shells because he is
> defining some custom completion functions,
> 
> 	git<TAB>
> 
> would show the git_complete function.  I think that's fine.

It depends on what else will go into that bash-helpers.bash file. If I have to source it to use git completion or the git-specific bash prompt, then I won't be very happy about it.

> Maybe
> the user would enjoy the reminder.
A reminder for what?

It's a configuration thing, so it will be used in .bashrc; I think it's quite unlikely that it will be used interactively.

Best, Gábor

Previous: Jonathan NiederNext: Jonathan Nieder
Message 14 of 24 in “completion: add new _GIT_complete helper”
  1. completion: add new _GIT_complete helperFelipe Contreras, May 5, 2012
  2. Jonathan NiederMay 5, 2012
  3. Felipe ContrerasMay 5, 2012
  4. Jonathan NiederMay 5, 2012
  5. Jonathan NiederMay 5, 2012
  6. Felipe ContrerasMay 5, 2012
  7. Jonathan gives feedback --> flamewars inevitable? (Re: [PATCH v3] completion: add new _GIT_complete helper)Jonathan Nieder, May 5, 2012
  8. Felipe ContrerasMay 5, 2012
  9. Jonathan NiederMay 5, 2012
  10. Jonathan NiederMay 5, 2012
  11. Tay Ray ChuanMay 6, 2012
  12. Felipe ContrerasMay 14, 2012
  13. Jonathan NiederMay 5, 2012
  14. SZEDER GáborMay 6, 2012
  15. Jonathan NiederMay 6, 2012
  16. SZEDER GáborMay 6, 2012
  17. SZEDER GáborMay 6, 2012
  18. SZEDER GáborMay 6, 2012
  19. SZEDER GáborMay 6, 2012
  20. Felipe ContrerasMay 6, 2012
  21. Felipe ContrerasMay 6, 2012
  22. SZEDER GáborMay 6, 2012
  23. Felipe ContrerasMay 7, 2012
  24. SZEDER GáborMay 7, 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.