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

Re: [RFC PATCH 3/6] Add namespace collision avoidance guidelines file

From
Kenneth Lorber <keni@his.com>
Date
May 18, 2020, 21:46 UTC
Message-ID
<19B52AC4-E3E0-4BA4-A383-8EA34681E9B6@his.com>
In-Reply-To
<xmqqh7we7f4b.fsf@gitster.c.googlers.com>
Show 10 quoted lines
> On May 17, 2020, at 11:31 AM, Junio C Hamano <gitster@pobox.com> wrote:
> 
> Kenneth Lorber <keni@hers.com> writes:
> 
>> From: Kenneth Lorber <keni@his.com>
>> 
>> Add a file of guidelines to prevent the namespace collisions
>> mentioned in git help config without any guidance.
> 
> Collisions with whom are you worried about?
This patch came about when I went to split config for a server's repo into a static part and a dynamic part.  The static part goes in a configuration repo (where it gets updated and pushed to production) while the dynamic part is written by the various git commands (and includes the static part).  Several things came to mind:
- config doesn't have an extension, so adding a new name with the same extension doesn't work
- what files will the current git version put into .git?  I don't know.
- how can I avoid picking names that will show up in future versions of git?
So the first answer is: collisions with git.

We also give our developers git extensions to help with our work flow. Some are aliases and some are hook scripts, with all the code living in .git/hooks (because that seemed the safest place); if git adds a new hook and I'm unlucky, all kinds of breakage are possible.

So the second answer is: collisions with organization or group extensions.
The third answer is theoretical: what happens if someone brings in a new git extension that collides with any of the above?
Show 8 quoted lines
> Random $stuff the end users want to have the namespace that governs
> $stuff (where $stuff could be an environment variable, a file on the
> filesystem, refname in git, etc.)?
> 
> Random $stuff third-party tools want to add?
> 
> As far as git is concerned, all the files under $GIT_DIR are
> blackbox and off-limits from end users

Where does it say that? I see this in the user manual: "cat .git/HEAD" so the user manual doesn't seem to press that point. Just looking for ".git" also shows: "you may instead put them in a file in your repository named `.git/info/exclude`" "touch proj.git/git-daemon-export-ok" "$ cat >> .git/config <<EOF" (note that this can cause all sorts of grief since it doesn't lock config) (etc)

That's not true though, is it?  config needs to be edited for all kinds of things, and while "git config -e" is probably the correct answer, a quick grep under Documentation shows zero hits for "config -e" and at least on place where the user manual says "by editing `.git/config` with a text editor".  The hooks directory is also fair game for both users and extensions.  (There's nothing mentioned about running more than one program from a hook, but that's an ugly bit of code I'm not likely to send out, so I'm going to ignore that conflict.)
> and third-party tools, so
> there is no collisions in "a file on the filesystem", but creating a
> ref may result in a creation of a file in $GIT_DIR/,
I wasn't aware of that, thanks.  It also demonstrates the need to say more about this topic in the docs since I thought I had found all the conflict sources.  (Got it - git help revisions, "1. If $GIT_DIR/<refname> exists, that is what you mean").

And here's a real (if contrived) oddity: $ git init $ echo a > file1 $ git add file1 $ git commit -m xx $ echo b >> file1 $ git commit -F .git/HEAD file1 $ git reflog COMMIT_EDITMSG 6fd4d85 COMMIT_EDITMSG@{0}: commit: ref: refs/heads/master 213ef7d COMMIT_EDITMSG@{1}: commit (initial): xx

Show 11 quoted lines
> and carving out
> a part of refs/* hierarchy for use by a third-party tool is a
> worthwhile goal.  Just like "git bisect" uses refs/bisect/* for its
> own operation and wants to reserve the hierarchy from other tools
> and the end users, any third-party tool would want a similar
> carve-out.  The same for configuration variables.
> 
> HOWEVER
> 
> I would rather not to see an arbitrary set of rules that are not
> battle-tested in the field added to our documentation.
I can't fault that, but I'd like to see more than what's there.
Show 10 quoted lines
> 
> Instead, my preference is to add a document that describes what
> namespaces (e.g. environment variable, reference, configuration
> varable) third-party tools may want carving out for themselves to
> raise awareness of writers of such tools, and tell them to talk to
> us on the list, saying "I plan to write a tool that wants to reserve
> refs/frotz/ hierarchy for its own use---comments?", so that people
> can respond with "I know a tool that already uses that hierarchy, so
> you'd need to come up with a different one" to save hassles of
> having to rename before it happens.
I don't think that's reasonable.  Individual users will not reach out to a mailing list to deal with their personal scripts - they'll just roll the dice.  Large corporations or startups in stealth mode may also be unable or unwilling to expose enough of their internal information to get a good recommendation in public.
> 
> After gaining experience from such exchanges, we might come up a set
> of rules so that no collisions would be possible without any
> coordination, and then we could document those rules.  

Would you be willing to support the "my" "this" and "our" levels while replacing the $ID section with a note for people expecting wide distribution of their extension to consult the mailing list?

Or even marking the entire section as "experimental - this may be updated as we gain experience with real world use; please consult the mailing list..." ?
> 
> I do not think that is plausible to happen, but that is OK.
I disagree, but then if I agreed I would not have submitted the patch :-)

Thanks for you comments, Keni

Previous: Junio C HamanoNext: Kenneth Lorber
Message 17 of 42 in “various documentation bits”
  1. 0/6 various documentation bitsKenneth Lorber, May 17, 2020
  2. 2/6 Add bit on extending git to Hacking GitKenneth Lorber, May 17, 2020
  3. Junio C HamanoMay 17, 2020
  4. Kenneth LorberMay 18, 2020
  5. 1/6 Tell the glossary about core.hooksPathKenneth Lorber, May 17, 2020
  6. Junio C HamanoMay 17, 2020
  7. Kenneth LorberMay 18, 2020
  8. 5/6 Tell config.txt about NAMESPACE COLLISIONSKenneth Lorber, May 17, 2020
  9. Junio C HamanoMay 18, 2020
  10. 4/6 Include NAMESPACE COLLISIONS doc into gitrepository-layout.txtKenneth Lorber, May 17, 2020
  11. Junio C HamanoMay 18, 2020
  12. Kenneth LorberMay 18, 2020
  13. 3/6 Add namespace collision avoidance guidelines fileKenneth Lorber, May 17, 2020
  14. Abhishek KumarMay 17, 2020
  15. Kenneth LorberMay 18, 2020
  16. Junio C HamanoMay 17, 2020
  17. Kenneth LorberMay 18, 2020
  18. 6/6 Add NAMESPACE COLLISIONS reference to Hacking GitKenneth Lorber, May 17, 2020
  19. Abhishek KumarMay 17, 2020
  20. Junio C HamanoMay 17, 2020
  21. Kenneth LorberMay 18, 2020
  22. Kenneth LorberMay 18, 2020
  23. 0/6 various documentation bitsKenneth Lorber, May 25, 2020
  24. 6/6 doc: Add collision reference to Hacking GitKenneth Lorber, May 25, 2020
  25. 2/6 doc: Add bit on extending git to Hacking GitKenneth Lorber, May 25, 2020
  26. 3/6 doc: Add namespace collision guidelines fileKenneth Lorber, May 25, 2020
  27. Junio C HamanoMay 28, 2020
  28. Junio C HamanoMay 28, 2020
  29. Junio C HamanoMay 29, 2020
  30. Junio C HamanoMay 29, 2020
  31. Kenneth LorberJun 1, 2020
  32. Kenneth LorberJun 1, 2020
  33. 4/6 doc: Add collision doc to gitrepository-layout.txtKenneth Lorber, May 25, 2020
  34. 1/6 doc: Tell the glossary about core.hooksPathKenneth Lorber, May 25, 2020
  35. Junio C HamanoMay 26, 2020
  36. Kenneth LorberMay 27, 2020
  37. Kenneth LorberMay 27, 2020
  38. Junio C HamanoMay 27, 2020
  39. 5/6 doc: Tell config.txt about namespace collisionsKenneth Lorber, May 25, 2020
  40. 0/2 update glossary hooks entryKenneth Lorber, May 31, 2020
  41. 1/2 doc: Tell the glossary about core.hooksPathKenneth Lorber, May 31, 2020
  42. 2/2 doc: remove dated info and refs to sample hooksKenneth Lorber, May 31, 2020

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.