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

Re: [PATCH v2] completion: add new git_complete helper

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 17, 2012, 07:10 UTC
Message-ID
<CAMP44s3OSepH_XpCcTWLN=bF0+P9fmHtyPnWdQnEocW25jHTpA@mail.gmail.com>
In-Reply-To
<20120416231626.GW12613@burratino>
On Tue, Apr 17, 2012 at 2:16 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 8 quoted lines
> Felipe Contreras wrote:
>
>> What makes you think this is public? It's under the section '# helper
>> functions', which doesn't seem to be public. Plus, it's repeated in
>> rpm, rpmbuild, and rpmbuild-md5.
>
> Ok, you win.  I hadn't realized we were having a debate, but now I do,
> and you have won.

I thought we were trying to agree on a good name for possibly the first (or second, depending how you count) public function. It's important to choose a good name because we can't just change it again in a month.

You are the one who brought the argument that even public functions have the '_' prefix, so it's *your* responsibility to substantiate that argument. I don't think it would be easy to find a precedent like this, but you can prove me wrong by providing the evidence; so far, I don't think that has happened.

> Can we get back to making the completion script nicer for human
> beings that have been using it, please?

Sure, but we need some sort of git_completion function if we want to make it easy for people to define aliases for git commands. And this is a known issue that has been brought in the past.

Show 12 quoted lines
> The following summary may sound annoyed, because I am.  On the other
> hand I know you mean well and am grateful for your work.
>
> I have said that the convention for bash completion scripts is to
> precede all exposed identifier names with an underscore.  You
> mentioned some old counterexamples that have been grandfathered in.
> You mentioned that you do not trust me.  Your bash completion script
> gets loaded immediately instead of being lazy-loaded, probably because
> it is not in /usr/share/bash-completion/completions/.  You claimed
> that nobody would _ever_ ask for bash completion support at the end of
> their .profile and after their custom functions in .profile that do
> something unrelated,

I did not claim such thing. I said that I *doubted* it, not that it was most definitely the case.

> though I used to do that for a long time and
> Debian's default .bashrc loads /etc/bash_completion at the end, too.

I see. That would be troublesome indeed (if somebody chose to add the function before that line, and not at the end), *if* somehow they used git_completion in their scripts.

> I still maintain that namespaces are useful and we should follow the
> conventional ones when they exist.  What is the next step?
What about this?
if ! type git_complete >/dev/null 2>&1; then
git_complete ()
{
	echo "WARNING: This function is not meant for public use; the name" \
		"might change. Use __git_complete for now."
	__git_complete "$@"
}
else
type git_complete | grep -q "WARNING" ||
echo "git_complete is already being used, please notify
git@vger.kernel.org, to" \
	"avoid overriding this function in the future."
fi

We can use that for 1.7.11, and if nobody complains remove the warnings for 1.7.12.

-- 
Felipe Contreras
Previous: Jonathan NiederNext: Jonathan Nieder
Message 25 of 40 in “completion: add new git_complete helper”
  1. completion: add new git_complete helperFelipe Contreras, Apr 15, 2012
  2. Jonathan NiederApr 15, 2012
  3. Felipe ContrerasApr 16, 2012
  4. Junio C HamanoApr 16, 2012
  5. Jonathan NiederApr 16, 2012
  6. Junio C HamanoApr 16, 2012
  7. Felipe ContrerasApr 16, 2012
  8. Jonathan NiederApr 16, 2012
  9. Felipe ContrerasApr 16, 2012
  10. Jonathan NiederApr 16, 2012
  11. Felipe ContrerasApr 16, 2012
  12. Jonathan NiederApr 16, 2012
  13. Felipe ContrerasApr 16, 2012
  14. Jonathan NiederApr 16, 2012
  15. Ville SkyttäApr 21, 2012
  16. Felipe ContrerasApr 21, 2012
  17. Ville SkyttäApr 21, 2012
  18. Felipe ContrerasApr 22, 2012
  19. Junio C HamanoApr 16, 2012
  20. Felipe ContrerasApr 16, 2012
  21. Jonathan NiederApr 16, 2012
  22. Felipe ContrerasApr 16, 2012
  23. Jonathan NiederApr 16, 2012
  24. Jonathan NiederApr 16, 2012
  25. Felipe ContrerasApr 17, 2012
  26. Jonathan NiederApr 17, 2012
  27. Felipe ContrerasApr 17, 2012
  28. Jonathan NiederApr 17, 2012
  29. Jonathan NiederApr 17, 2012
  30. Jonathan NiederApr 16, 2012
  31. SZEDER GáborApr 16, 2012
  32. Felipe ContrerasApr 16, 2012
  33. Junio C HamanoApr 17, 2012
  34. Felipe ContrerasApr 17, 2012
  35. Junio C HamanoApr 17, 2012
  36. Felipe ContrerasApr 17, 2012
  37. Jonathan NiederApr 17, 2012
  38. SZEDER GáborApr 17, 2012
  39. Felipe ContrerasApr 17, 2012
  40. SZEDER GáborApr 17, 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.