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

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

From
Jonathan Nieder <jrnieder@gmail.com>
Date
May 5, 2012, 15:54 UTC
Message-ID
<20120505155423.GA14684@burratino>
In-Reply-To
<1336231400-6878-1-git-send-email-felipe.contreras@gmail.com>
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.

Following a convention similar to the bash-completion project's proposed future convention doesn't really help compatibility. If we want to be able to include this function in that project without change some day, we'd have to call it _BC_git_complete. :)

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. Maybe the user would enjoy the reminder. git<TAB> also shows any dashed-form git commands that happen to be on the $PATH.

Please don't take this as a strong objection. Maybe the user-unfriendly version would be called _GIT_complete and someone interested can provide the friendly git_complete and git_ps1 wrappers separately, for example. I just think it is worth thinking carefully and being consistent about.

Hope that helps, Jonathan

Previous: Felipe ContrerasNext: Felipe Contreras
Message 2 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.