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, 15:51 UTC
Message-ID
<E3FDDD1B-E0D9-4F20-8B4A-FCC5933F7093@his.com>
In-Reply-To
<20200517094513.GA947@Abhishek-Arch>
Show 16 quoted lines
> On May 17, 2020, at 5:45 AM, Abhishek Kumar <abhishekkumar8222@gmail.com> wrote:
> 
> Hello Kenneth,
> 
> On Sat, May 16, 2020 at 10:13:41PM -0400, Kenneth Lorber wrote:
>> From: Kenneth Lorber <keni@his.com>
>> 
>> Add a file of guidelines to prevent the namespace collisions
>> mentioned in git help config without any guidance.
>> 
>> Signed-off-by: Kenneth Lorber <keni@his.com>
>> ---
> 
> Since most users (including me) have never faced a namespace collision
> with Git before, you might have to make a stronger case for why this
> adding namespace collisions to documentation is important.
(This will be addressed in a followup email to a reply later in my inbox.)
> 
> I honestly don't have enough knowledge of Git internals to talk about
> any changes to the guidelines itself.
Fair enough.
Show 32 quoted lines
> 
>> Documentation/gitrepository-layout.txt        |  1 +
>> .../technical/namespace-collisions.txt        | 86 +++++++++++++++++++
>> 2 files changed, 87 insertions(+)
>> create mode 100644 Documentation/technical/namespace-collisions.txt
>> 
>> diff --git a/Documentation/gitrepository-layout.txt b/Documentation/gitrepository-layout.txt
>> index 1a2ef4c150..a84a4df513 100644
>> --- a/Documentation/gitrepository-layout.txt
>> +++ b/Documentation/gitrepository-layout.txt
>> @@ -290,6 +290,7 @@ worktrees/<id>/locked::
>> worktrees/<id>/config.worktree::
>> 	Working directory specific configuration file.
>> 
>> +include::technical/namespace-collisions.txt[]
>> include::technical/repository-version.txt[]
>> 
>> SEE ALSO
>> diff --git a/Documentation/technical/namespace-collisions.txt b/Documentation/technical/namespace-collisions.txt
>> new file mode 100644
>> index 0000000000..fb79c82a73
>> --- /dev/null
>> +++ b/Documentation/technical/namespace-collisions.txt
>> @@ -0,0 +1,86 @@
>> +gitattributes
>> +
>> +
>> +NAMESPACE COLLISIONS
>> +--------------------
> 
> A convention I have noticed is that "========" is for the document
> header and "--------" is for section headers.

At the moment at least this is not a stand-alone document, it is included as a section in gitrepository-layout.txt. (See patch 4.) It's a separate file because I thought it likely someone would suggest putting the content elsewhere or, as you seem to have assumed, it could be a stand-alone document.

Show 88 quoted lines
> 
>> +Git uses identifiers in a number of different namespaces:
>> +
>> +* environment variables
>> +* files in $GIT_DIR
>> +* files in the working trees
>> +* config sections
>> +* hooks
>> +* attributes
>> +
>> +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.
>> +
>> +Names reserved to Git:
>> +
>> +* file or directory names ending with `.lock`
>> +* file or directory names starting with `.git`
>> +* filenames in $GIT_DIR
>> +* directory names in $GIT_DIR unless allowed by a rule below
>> +* environment variables starting with `GIT_`
>> +* configuration file sections unless allowed by a rule below
>> +* file or directory names in `$GIT_DIR/hooks` unless allowed by a rule below
>> +* attributes unless allowed by a rule below
>> +
>> +
>> +Names reserved for individual users:
>> +
>> +* The directory `$GIT_DIR/my`
>> +* Environment variables starting with `GIT_MY_`
>> +* Configuration section `my`
>> +* Files or directories in `$GIT_DIR/hooks` starting with `my_`
>> +* Attributes starting with `my_`
>> +
>> +Names reserved for individual repos:
>> +
>> +* The directory `$GIT_DIR/this`
>> +* Environment variables starting with `GIT_THIS_`
>> +* Configuration section `this`
>> +* Files or directories in `$GIT_DIR/hooks` starting with `this_`
>> +* Attributes starting with `this_`
>> +
>> +Names reserved for the lowest level group of people:
>> +
>> +* The directory `$GIT_DIR/our`
>> +* Environment variables starting with `GIT_OUR_`
>> +* Configuration section `our`
>> +* Files or directories in `$GIT_DIR/hooks` starting with `our_`
>> +* Attributes starting with `our_`
>> +
>> +Names reserved for larger groups of people, for companies,
>> +or for extensions that are distributed outside of the originating group:
>> +
>> +$ID is defined as a reverse DNS-style name, with dots replaced by
>> +underscores (preferably) or by hyphens (if necessary).  The $ID
>> +can have as many sections as possible, thus `com.example.sitename.projectid`
>> +is perfectly reasonable.  Use of a name based on a domain you control is
>> +highly recommended; if you do not control a domain, constructing the base of $ID
>> +from your email address is a reasonable alternative, but use double delimiters
>> +in place of the @ sign; for example: `com.example--root.project`
>> +
>> +* The directory $GIT_DIR/$ID
>> +* Environment variables starting with `GIT__$ID_` (note two underscores)
>> +* Configuration section `GIT--$ID`
>> +* Files or directories in `$GIT_DIR/hooks` starting with $ID
>> +* Attributes starting with `git__` (note two underscores)
>> +
>> +Aliases
>> +~~~~~~~
>> +Aliases are a special case.  Users need to type them so they should be
>> +short, but there is no way to prevent such short names from colliding.
>> +So the documentation or installer should construct something like:
>> +
>> +  [alias]
>> +     test = !git my-test
>> +     my-test = !echo made it
>> +
>> +while detecting collisions for the short name.  Then users or local
>> +policy can deal with collisions on the short name.
>> +
>> +This is not meant to cover every possible use case - a policy that
>> +detailed would be ignored and thus of no use.  Please play nicely.
>> -- 
>> 2.17.1
>> 
> 
> Regards
> Abhishek

Thanks, Keni

Previous: Abhishek KumarNext: Junio C Hamano
Message 15 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.