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

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

From
Kenneth Lorber <keni@his.com>
Date
Jun 1, 2020, 18:38 UTC
Message-ID
<B170FDD5-0B2C-48AB-92F4-223394823754@his.com>
In-Reply-To
<xmqqy2pb3new.fsf@gitster.c.googlers.com>
Show 20 quoted lines
> On May 28, 2020, at 2:49 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 
> Kenneth Lorber <keni@his.com> writes:
> 
>> +Git uses identifiers in a number of different namespaces:
>> +
>> +* environment variables
>> +* files in $GIT_DIR
>> +* files in the working trees
>> +* config sections
>> +* hooks
>> +* attributes
> 
> The names of the subcommands "git" can spawn is a shared resource.
> You can install "git-imerge" program in one of the directories on
> your $PATH and say "git imerge" to invoke the program.  
> 
> Two third-party developers may have to coordinate to avoid giving
> the same name to their totally-unrelated tools, if they hope that
> both of their tools to be useful in the larger Git ecosystem.
So similar to the aliases case.
Show 10 quoted lines
> 
>> +In order to reduce the chance of collisions between names Git uses
>> +and those used by other entities (users, groups, and extension authors),
>> +the following are recommended best practices.
> 
> OK.
> 
>> +Names reserved to Git:
> 
> s/to/by/ perhaps.

I don't believe so. For example, under this proposal, the "my" items are reserved by Git for the user, while the items in this section are reserved to git itself.

s/to/for/ might be clearer?
Show 14 quoted lines
> 
>> +Names reserved for individual users:
>> +
>> +* The directory `$GIT_DIR/my`
> 
> So an individual user is allowed to store anything in that
> directory, and "git" or any third-party tools won't care.  OK.
> 
>> +* Environment variables starting with `GIT_MY_`
> 
> Likewise.  But then the users can use MY_FOO_BLAH without GIT_
> prefix in the first place, so there isn't much gain there.  Downside
> for "git" and third-party tool authors is not so big (just the loss
> of a single prefix "_MY"), so perhaps it is OK.

The environment variable namespace is a mess in general; subdividing something well known (GIT_) seemed safer then hoping for MY to be available.

Also, and this applies to some of the other cases below, one goal was to make the rules as simple and therefore as consistent as possible. So we reserve the same names everywhere we can - little cost, added simplicity.

Show 9 quoted lines
> 
>> +* Configuration section `my`
>> +* Files or directories in `$GIT_DIR/hooks` starting with `my_`
>> +* Attributes starting with `my_`
> 
> The last one does not make much sense.  You have to forbid defining
> my_attributes in .gitattributes files that are tracked in-tree;
> otherwise I cannot work with you on the same project, because I
> cannot use my_attributes for my own purpose in that project.
Yes, but they can be useful in $HOME/.config/git/attributes.
>  For
> the same reason, reserving attributes for individual repositories
> does not make much sense, either.

I may not be following you on this one. What about the use case of a filter written specifically for a project-specific file type? That would be a "this" attribute so it doesn't collide with anything else.

Show 8 quoted lines
> 
>> +Names reserved for individual repos:
>> +
>> +* The directory `$GIT_DIR/this`
> 
> It is unclear what it means to have $GIT_DIR/my and $GIT_DIR/this
> and how to choose which one of these two ought to be used for each
> occasion a user finds a need to store something in these places.

$GIT_DIR/my would be something a user installs to their local clone to do something they want personally (contrived example: it's a good place to put their non-standard editor's temp files so they don't have to touch the shared .gitignore files).

$GIT_DIR/this would be used for things that everyone working on that one repo needs, but only for that one repo.

More generally, I'm not hoping to guess every possible use case, I'm trying to specify a policy that can accommodate all possible use cases - so generality over specific justifications.

Show 12 quoted lines
> 
>> +* Environment variables starting with `GIT_THIS_`
> 
> The utility of this one is dubious.  
> 
> 	$ export GIT_THIS_BLAH=value
> 	$ cd repo1 ; work work work
> 	$ cd ../repo2 ; work work work
> 
> Unless you arrange to reset GIT_THIS_* environment variable every
> time you visit a separate repository, it would not be pratical to
> use.

If you only consider env vars being passed in from the user or shell initialization, I think you are correct. However they could be useful for passing information from one program to another. Passing information into a custom editor invoked from git commit might be a use case.

But again, being uniform is better than not. 
> 
>> +Names reserved for the lowest level group of people:
> 
> What's lowest level group of people?
Purposefully unspecified, but I can understand if I can't get away with that.

The lowest level group of people could be two people doing agile development, everyone with a particular supervisor, a college class, a family, a department. It's the last chance to be informal, before you either use the third-party guidelines or go to the mailing list to ask for help.

Which brings us to:
> 
> Also, where did the guideline for third-party tools go?

That was in response to a comment from Abhishek Kumar; it was a mistake on my part to take silence from both of you as agreement on my compromise (which involved dropping the third-party section).

I'll put it back if I get enough encouragement to cut a v3.
Show 6 quoted lines
> 
> At this point I need to say that this is not very well thought out
> (yet), or that this is not very well explained, or perhaps both,
> so I'll stop commenting on it for now.
> 
> Thanks.

You're welcome. I've got 3 more emails from you to reply to but it may not happen today.

Previous: Kenneth LorberNext: Kenneth Lorber
Message 32 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.