threads / rfc / 53489

RFC patch, 6 partsAdd bit on extending git to Hacking Git

Subject: [RFC PATCH 2/6] Add bit on extending git to Hacking Git

## tl;dr

42 messages between May 17, 2020 and Jun 1, 2020. Diffs are folded; open one to read it.

replies: 41people: 4as markdown or json

Kenneth Lorber· May 17, 2020, 02:13 UTC · lore

[RFC PATCH 0/6] various documentation bits

From: Kenneth Lorber <keni@his.com>
This started as an effort to understand this section of config.txt:
  When inventing new variables for use in your own tool, make sure their
  names do not conflict with those that are used by Git itself and
  other popular tools, and describe them in your documentation.
and grew from there.

I don't expect this to be adopted as is, but I've found it much easier to discuss something concrete rather than an abstract "this is incomplete" or "this is hard to find."

Cut from master.
keni (6):
  Tell the glossary about core.hooksPath
  Add bit on extending git to Hacking Git
  Add namespace collision avoidance guidelines file
  Include NAMESPACE COLLISIONS doc into gitrepository-layout.txt
  Tell config.txt about NAMESPACE COLLISIONS
  Add NAMESPACE COLLISIONS reference to Hacking Git
 Documentation/config.txt                      |  4 +-
 Documentation/gitrepository-layout.txt        |  2 +
 Documentation/glossary-content.txt            | 10 ++-
 .../technical/namespace-collisions.txt        | 86 +++++++++++++++++++
 Documentation/user-manual.txt                 |  9 ++
 5 files changed, 106 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/technical/namespace-collisions.txt
-- 
2.17.1
Kenneth Lorber· May 17, 2020, 02:13 UTC · re: Kenneth Lorber · lore
From: Kenneth Lorber <keni@his.com>

The Hacking Git section of the user manual is the logical place to look for information on extending Gut, so add a short section of links to places where that information actually lives.

Signed-off-by: Kenneth Lorber <keni@his.com>
---
 Documentation/user-manual.txt | 8 ++++++++
 1 file changed, 8 insertions(+)
Show changes to Documentation/user-manual.txt +8 −0
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 833652983f..2144246444 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -4049,6 +4049,14 @@ and that is what higher level `git merge -s resolve` is implemented with.
 This chapter covers internal details of the Git implementation which
 probably only Git developers need to understand.
 
+If you are extending Git using hooks, writing new tools, or otherwise
+looking for technical information but not hacking Git itself, the following
+documents may be what you are really looking for:
+
+* hooks: linkgit:githooks[5]
+* attributes: linkgit:gitattributes[5]
+* new tools: linkgit:git-sh-setup[1]
+
 [[object-details]]
 === Object storage format
 
-- 
2.17.1
Junio C Hamano· May 17, 2020, 18:34 UTC · re: Kenneth Lorber · lore

Re: [RFC PATCH 2/6] Add bit on extending git to Hacking Git

Kenneth Lorber <keni@hers.com> writes:
Show 26 quoted lines
> From: Kenneth Lorber <keni@his.com>
>
> The Hacking Git section of the user manual is the logical place to look
> for information on extending Gut, so add a short section of links to
> places where that information actually lives.
>
> Signed-off-by: Kenneth Lorber <keni@his.com>
> ---
>  Documentation/user-manual.txt | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
> index 833652983f..2144246444 100644
> --- a/Documentation/user-manual.txt
> +++ b/Documentation/user-manual.txt
> @@ -4049,6 +4049,14 @@ and that is what higher level `git merge -s resolve` is implemented with.
>  This chapter covers internal details of the Git implementation which
>  probably only Git developers need to understand.
>  
> +If you are extending Git using hooks, writing new tools, or otherwise
> +looking for technical information but not hacking Git itself, the following
> +documents may be what you are really looking for:
> +
> +* hooks: linkgit:githooks[5]
> +* attributes: linkgit:gitattributes[5]
> +* new tools: linkgit:git-sh-setup[1]

I am not sure if this fits here. It is a distraction to the target audience of this section, no?

Kenneth Lorber· May 18, 2020, 22:10 UTC · re: Junio C Hamano · lore

Re: [RFC PATCH 2/6] Add bit on extending git to Hacking Git

Show 33 quoted lines
> On May 17, 2020, at 2:34 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 
> Kenneth Lorber <keni@hers.com> writes:
> 
>> From: Kenneth Lorber <keni@his.com>
>> 
>> The Hacking Git section of the user manual is the logical place to look
>> for information on extending Gut, so add a short section of links to
>> places where that information actually lives.
>> 
>> Signed-off-by: Kenneth Lorber <keni@his.com>
>> ---
>> Documentation/user-manual.txt | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>> 
>> diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
>> index 833652983f..2144246444 100644
>> --- a/Documentation/user-manual.txt
>> +++ b/Documentation/user-manual.txt
>> @@ -4049,6 +4049,14 @@ and that is what higher level `git merge -s resolve` is implemented with.
>> This chapter covers internal details of the Git implementation which
>> probably only Git developers need to understand.
>> 
>> +If you are extending Git using hooks, writing new tools, or otherwise
>> +looking for technical information but not hacking Git itself, the following
>> +documents may be what you are really looking for:
>> +
>> +* hooks: linkgit:githooks[5]
>> +* attributes: linkgit:gitattributes[5]
>> +* new tools: linkgit:git-sh-setup[1]
> 
> I am not sure if this fits here.  It is a distraction to the target
> audience of this section, no?
I agree and still think this is where it goes (unless we start a new chapter on hacking FOR git, which is more than I can handle at the moment).
My reasoning is that from the available chapters, this is my best bet (as a new user) for finding this information; pointing them elsewhere isn't that big a distraction (it's at the top and short) and would be a great help for people looking for that kind of info.
My two cents anyway.
Kenneth Lorber· May 17, 2020, 02:13 UTC · re: Kenneth Lorber · lore

[RFC PATCH 1/6] Tell the glossary about core.hooksPath

From: Kenneth Lorber <keni@his.com>
The user manual glossary entry for hooks now knows about core.hooksPath.
Signed-off-by: Kenneth Lorber <keni@his.com>
---
 Documentation/glossary-content.txt | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
Show changes to Documentation/glossary-content.txt +6 −4
diff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt
index 090c888335..37147db1bc 100644
--- a/Documentation/glossary-content.txt
+++ b/Documentation/glossary-content.txt
@@ -206,10 +206,12 @@ for a more flexible and robust system to do the same thing.
 	to optional scripts that allow a developer to add functionality or
 	checking. Typically, the hooks allow for a command to be pre-verified
 	and potentially aborted, and allow for a post-notification after the
-	operation is done. The hook scripts are found in the
-	`$GIT_DIR/hooks/` directory, and are enabled by simply
-	removing the `.sample` suffix from the filename. In earlier versions
-	of Git you had to make them executable.
+	operation is done. The hook scripts are found in `$GIT_DIR/hooks/`
+	or in any directory specified by the `core.hooksPath` configuration
+	variable.  The sample scripts are enabled by simply
+	removing the `.sample` suffix from the filename.  In earlier versions
+	of Git you had to make the sample scripts executable manually.
+	Hook scripts must be executable.  See linkgit:githooks[5] for details.
 
 [[def_index]]index::
 	A collection of files with stat information, whose contents are stored
-- 
2.17.1
Junio C Hamano· May 17, 2020, 18:33 UTC · re: Kenneth Lorber · lore

Re: [RFC PATCH 1/6] Tell the glossary about core.hooksPath

Kenneth Lorber <keni@hers.com> writes:
Show 8 quoted lines
> From: Kenneth Lorber <keni@his.com>
>
> The user manual glossary entry for hooks now knows about core.hooksPath.
>
> Signed-off-by: Kenneth Lorber <keni@his.com>
> ---
>  Documentation/glossary-content.txt | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
That's a gap worth filling.
Show 14 quoted lines
> diff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt
> index 090c888335..37147db1bc 100644
> --- a/Documentation/glossary-content.txt
> +++ b/Documentation/glossary-content.txt
> @@ -206,10 +206,12 @@ for a more flexible and robust system to do the same thing.
>  	to optional scripts that allow a developer to add functionality or
>  	checking. Typically, the hooks allow for a command to be pre-verified
>  	and potentially aborted, and allow for a post-notification after the
> -	operation is done. The hook scripts are found in the
> -	`$GIT_DIR/hooks/` directory, and are enabled by simply
> -	removing the `.sample` suffix from the filename. In earlier versions
> -	of Git you had to make them executable.
> +	operation is done. The hook scripts are found in `$GIT_DIR/hooks/`
> +	or in any directory specified by the `core.hooksPath` configuration
I expect "the", instead of "any", would make more sense to readers.

It is true that you can choose any directory of your liking and specify it via the variable, but once chosen that would be the only directory used for the purpose.

Show 7 quoted lines
> +	variable.  The sample scripts are enabled by simply
> +	removing the `.sample` suffix from the filename.  In earlier versions
> +	of Git you had to make the sample scripts executable manually.
> +	Hook scripts must be executable.  See linkgit:githooks[5] for details.
>  
>  [[def_index]]index::
>  	A collection of files with stat information, whose contents are stored
Thanks.
Kenneth Lorber· May 18, 2020, 22:06 UTC · re: Junio C Hamano · lore

Re: [RFC PATCH 1/6] Tell the glossary about core.hooksPath

Show 14 quoted lines
> On May 17, 2020, at 2:33 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 
> Kenneth Lorber <keni@hers.com> writes:
> 
>> From: Kenneth Lorber <keni@his.com>
>> 
>> The user manual glossary entry for hooks now knows about core.hooksPath.
>> 
>> Signed-off-by: Kenneth Lorber <keni@his.com>
>> ---
>> Documentation/glossary-content.txt | 10 ++++++----
>> 1 file changed, 6 insertions(+), 4 deletions(-)
> 
> That's a gap worth filling.
Thanks.
Show 17 quoted lines
> 
>> diff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt
>> index 090c888335..37147db1bc 100644
>> --- a/Documentation/glossary-content.txt
>> +++ b/Documentation/glossary-content.txt
>> @@ -206,10 +206,12 @@ for a more flexible and robust system to do the same thing.
>> 	to optional scripts that allow a developer to add functionality or
>> 	checking. Typically, the hooks allow for a command to be pre-verified
>> 	and potentially aborted, and allow for a post-notification after the
>> -	operation is done. The hook scripts are found in the
>> -	`$GIT_DIR/hooks/` directory, and are enabled by simply
>> -	removing the `.sample` suffix from the filename. In earlier versions
>> -	of Git you had to make them executable.
>> +	operation is done. The hook scripts are found in `$GIT_DIR/hooks/`
>> +	or in any directory specified by the `core.hooksPath` configuration
> 
> I expect "the", instead of "any", would make more sense to readers.

I agree, but I copied it from user-manual.txt, search for core.excludesFile. Should it be changed there as well?

Show 14 quoted lines
> 
> It is true that you can choose any directory of your liking and
> specify it via the variable, but once chosen that would be the only
> directory used for the purpose.
> 
>> +	variable.  The sample scripts are enabled by simply
>> +	removing the `.sample` suffix from the filename.  In earlier versions
>> +	of Git you had to make the sample scripts executable manually.
>> +	Hook scripts must be executable.  See linkgit:githooks[5] for details.
>> 
>> [[def_index]]index::
>> 	A collection of files with stat information, whose contents are stored
> 
> Thanks.
You're welcome.
Kenneth Lorber· May 17, 2020, 02:13 UTC · re: Kenneth Lorber · lore

[RFC PATCH 5/6] Tell config.txt about NAMESPACE COLLISIONS

From: Kenneth Lorber <keni@his.com>

Add a link to the NAMESPACE COLLISIONS information where git help config only mentioned the issue without supplying any guidance for how to do that.

Signed-off-by: Kenneth Lorber <keni@his.com>
---
 Documentation/config.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Show changes to Documentation/config.txt +3 −1
diff --git a/Documentation/config.txt b/Documentation/config.txt
index ef0768b91a..1e819c26f0 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -310,7 +310,9 @@ in the appropriate manual page.
 Other git-related tools may and do use their own variables.  When
 inventing new variables for use in your own tool, make sure their
 names do not conflict with those that are used by Git itself and
-other popular tools, and describe them in your documentation.
+other popular tools, and describe them in your documentation.  See
+'NAMESPACE COLLISIONS' in linkgit:gitrepository-layout[5] for guidelines
+to prevent such conflicts.
 
 include::config/advice.txt[]
 
-- 
2.17.1
Junio C Hamano· May 18, 2020, 00:32 UTC · re: Kenneth Lorber · lore

Re: [RFC PATCH 5/6] Tell config.txt about NAMESPACE COLLISIONS

Kenneth Lorber <keni@hers.com> writes:
Show 22 quoted lines
> From: Kenneth Lorber <keni@his.com>
>
> Add a link to the NAMESPACE COLLISIONS information where git help config
> only mentioned the issue without supplying any guidance for how to do that.
>
> Signed-off-by: Kenneth Lorber <keni@his.com>
> ---
>  Documentation/config.txt | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index ef0768b91a..1e819c26f0 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -310,7 +310,9 @@ in the appropriate manual page.
>  Other git-related tools may and do use their own variables.  When
>  inventing new variables for use in your own tool, make sure their
>  names do not conflict with those that are used by Git itself and
> -other popular tools, and describe them in your documentation.
> +other popular tools, and describe them in your documentation.  See
> +'NAMESPACE COLLISIONS' in linkgit:gitrepository-layout[5] for guidelines
> +to prevent such conflicts.

The configuration variable namespace is a shared resource, and it does make sense to give a provision for third-party tools to coordinate to avoid stepping on each others' toes.

The repository-layout document is about a physical on-filesystem structure that ought to be blackbox to third-party tools, so the link target may have to be different from what this patch wants to add, though.

I'd rather not to have such a document prematurely; if we were to add something to this paragraph (and I do think it is a good idea to say a bit more than "you're on your own but make sure you do not conflict with Git and other people" which is what we have there in the original), I'd just stop at telling readers to come here to the list to discuss and solicit input from other Git stakeholders.

Thanks.
Kenneth Lorber· May 17, 2020, 02:13 UTC · re: Kenneth Lorber · lore

[RFC PATCH 4/6] Include NAMESPACE COLLISIONS doc into gitrepository-layout.txt

From: Kenneth Lorber <keni@his.com>
Signed-off-by: Kenneth Lorber <keni@his.com>
---
 Documentation/gitrepository-layout.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Show changes to Documentation/gitrepository-layout.txt +2 −1
diff --git a/Documentation/gitrepository-layout.txt b/Documentation/gitrepository-layout.txt
index a84a4df513..8050e8cc1f 100644
--- a/Documentation/gitrepository-layout.txt
+++ b/Documentation/gitrepository-layout.txt
@@ -290,9 +290,10 @@ worktrees/<id>/locked::
 worktrees/<id>/config.worktree::
 	Working directory specific configuration file.
 
-include::technical/namespace-collisions.txt[]
 include::technical/repository-version.txt[]
 
+include::technical/namespace-collisions.txt[]
+
 SEE ALSO
 --------
 linkgit:git-init[1],
-- 
2.17.1
Junio C Hamano· May 18, 2020, 00:26 UTC · re: Kenneth Lorber · lore

Re: [RFC PATCH 4/6] Include NAMESPACE COLLISIONS doc into gitrepository-layout.txt

Kenneth Lorber <keni@hers.com> writes:
Show 6 quoted lines
> From: Kenneth Lorber <keni@his.com>
>
> Signed-off-by: Kenneth Lorber <keni@his.com>
> ---
>  Documentation/gitrepository-layout.txt | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

As I said elsewhere, I am not sure if we want to even let third-party tools direct access at the filesystem level to $GIT_DIR/. We do want to say things like where the ref namespace that are taken as "per worktree" are located, so that a third-party tool wants to carve out a hierarchy out of the per-worktree part of the ref namespace, that may indirectly influence where on the filesystem under $GIT_DIR/ their stuff is stored, but how we decide to store refs inside $GIT_DIR/ should still be blackbox to these third-party tools (e.g. we may not be using loose or packed refs, but using a chain of reftable files).

So from that point of view, we shouldn't have to touch the repository layout document, I would think.

Show 16 quoted lines
> diff --git a/Documentation/gitrepository-layout.txt b/Documentation/gitrepository-layout.txt
> index a84a4df513..8050e8cc1f 100644
> --- a/Documentation/gitrepository-layout.txt
> +++ b/Documentation/gitrepository-layout.txt
> @@ -290,9 +290,10 @@ worktrees/<id>/locked::
>  worktrees/<id>/config.worktree::
>  	Working directory specific configuration file.
>  
> -include::technical/namespace-collisions.txt[]
>  include::technical/repository-version.txt[]
>  
> +include::technical/namespace-collisions.txt[]
> +
>  SEE ALSO
>  --------
>  linkgit:git-init[1],
Kenneth Lorber· May 18, 2020, 23:54 UTC · re: Junio C Hamano · lore

Re: [RFC PATCH 4/6] Include NAMESPACE COLLISIONS doc into gitrepository-layout.txt

Show 21 quoted lines
> On May 17, 2020, at 8:26 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 
> Kenneth Lorber <keni@hers.com> writes:
> 
>> From: Kenneth Lorber <keni@his.com>
>> 
>> Signed-off-by: Kenneth Lorber <keni@his.com>
>> ---
>> Documentation/gitrepository-layout.txt | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> As I said elsewhere, I am not sure if we want to even let
> third-party tools direct access at the filesystem level to
> $GIT_DIR/.  We do want to say things like where the ref namespace
> that are taken as "per worktree" are located, so that a third-party
> tool wants to carve out a hierarchy out of the per-worktree part of
> the ref namespace, that may indirectly influence where on the
> filesystem under $GIT_DIR/ their stuff is stored, but how we decide
> to store refs inside $GIT_DIR/ should still be blackbox to these
> third-party tools (e.g. we may not be using loose or packed refs,
> but using a chain of reftable files).  
Probably true in the abstract, but the current situation is an undefined mix.  Changing it is almost certainly more work than it's worth (my little game with COMMIT_EDITMSG notwithstanding), but documenting some safe places for end users seems reasonable to me.
> 
> So from that point of view, we shouldn't have to touch the
> repository layout document, I would think.

Where the information goes is certainly up for debate - that's why I put it in its own file. Any suggestions for a better place?

(It looks like I may not have backed up far enough when I cut this diff.  I'll fix that for v2.)
Show 17 quoted lines
> 
>> diff --git a/Documentation/gitrepository-layout.txt b/Documentation/gitrepository-layout.txt
>> index a84a4df513..8050e8cc1f 100644
>> --- a/Documentation/gitrepository-layout.txt
>> +++ b/Documentation/gitrepository-layout.txt
>> @@ -290,9 +290,10 @@ worktrees/<id>/locked::
>> worktrees/<id>/config.worktree::
>> 	Working directory specific configuration file.
>> 
>> -include::technical/namespace-collisions.txt[]
>> include::technical/repository-version.txt[]
>> 
>> +include::technical/namespace-collisions.txt[]
>> +
>> SEE ALSO
>> --------
>> linkgit:git-init[1],
Kenneth Lorber· May 17, 2020, 02:13 UTC · re: Kenneth Lorber · lore

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

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>
---
 Documentation/gitrepository-layout.txt        |  1 +
 .../technical/namespace-collisions.txt        | 86 +++++++++++++++++++
 2 files changed, 87 insertions(+)
 create mode 100644 Documentation/technical/namespace-collisions.txt
Show changes to 2 files +87 −0

Documentation/gitrepository-layout.txt, 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
+--------------------
+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
Abhishek Kumar· May 17, 2020, 09:45 UTC · re: Kenneth Lorber · lore

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

Hello Kenneth,
On Sat, May 16, 2020 at 10:13:41PM -0400, Kenneth Lorber wrote:
Show 7 quoted lines
> 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.

I honestly don't have enough knowledge of Git internals to talk about any changes to the guidelines itself.

Show 28 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.

Show 84 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

Kenneth Lorber· May 18, 2020, 15:51 UTC · re: Abhishek Kumar · lore

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

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

Junio C Hamano· May 17, 2020, 15:31 UTC · re: Kenneth Lorber · lore

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

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?

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 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/, 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.

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.

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.

I do not think that is plausible to happen, but that is OK.
Kenneth Lorber· May 18, 2020, 21:46 UTC · re: Junio C Hamano · lore

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

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

Kenneth Lorber· May 17, 2020, 02:13 UTC · re: Kenneth Lorber · lore

[RFC PATCH 6/6] Add NAMESPACE COLLISIONS reference to Hacking Git

From: Kenneth Lorber <keni@his.com>
Signed-off-by: Kenneth Lorber <keni@his.com>
---
 Documentation/user-manual.txt | 1 +
 1 file changed, 1 insertion(+)
Show changes to Documentation/user-manual.txt +1 −0
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 2144246444..4ceba4a943 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -4056,6 +4056,7 @@ documents may be what you are really looking for:
 * hooks: linkgit:githooks[5]
 * attributes: linkgit:gitattributes[5]
 * new tools: linkgit:git-sh-setup[1]
+* avoiding namespace collisions: linkgit:gitrepository-layout[5]
 
 [[object-details]]
 === Object storage format
-- 
2.17.1
Abhishek Kumar· May 17, 2020, 07:42 UTC · re: Kenneth Lorber · lore

Re: [RFC PATCH 0/6] various documentation bits

Hello Kenneth,
On Sat, May 16, 2020 at 10:13:38PM -0400, Kenneth Lorber wrote:
Show 33 quoted lines
> From: Kenneth Lorber <keni@his.com>
> 
> This started as an effort to understand this section of config.txt:
>   When inventing new variables for use in your own tool, make sure their
>   names do not conflict with those that are used by Git itself and
>   other popular tools, and describe them in your documentation.
> and grew from there.
> 
> I don't expect this to be adopted as is, but I've found it much easier
> to discuss something concrete rather than an abstract "this is
> incomplete" or "this is hard to find."
> 
> Cut from master.
> 
> keni (6):
>   Tell the glossary about core.hooksPath
>   Add bit on extending git to Hacking Git
>   Add namespace collision avoidance guidelines file
>   Include NAMESPACE COLLISIONS doc into gitrepository-layout.txt
>   Tell config.txt about NAMESPACE COLLISIONS
>   Add NAMESPACE COLLISIONS reference to Hacking Git
> 
>  Documentation/config.txt                      |  4 +-
>  Documentation/gitrepository-layout.txt        |  2 +
>  Documentation/glossary-content.txt            | 10 ++-
>  .../technical/namespace-collisions.txt        | 86 +++++++++++++++++++
>  Documentation/user-manual.txt                 |  9 ++
>  5 files changed, 106 insertions(+), 5 deletions(-)
>  create mode 100644 Documentation/technical/namespace-collisions.txt
> 
> -- 
> 2.17.1
> 
Some general notes about your patch series:
1. Conventionally, we prefix the first line with "area: " where the area
is a filename or identifier for general area of the code being modified.
It's customary to start the remainder of the first line after "area: "
with a lower-case letter.
For example, your commit titles could have been:
- doc: tell the glossary about core.hooksPath
- doc: add bit on extending git to hacking Git
and so on.
Check out SubmittingPatches for more information.
2. We generally don't have a line like in our patches:
> From Kenneth Lorber <keni@his.com>
Between the author information and the signed-off-by, it's redundant.
3. You could probably join the patches 3 to 6 together. Or maybe
introduce namespace-collisions.txt in third patch and add references in
all other files in a new, fourth patch.
Thanks for the contribution!

Regards Abhishek

Junio C Hamano· May 17, 2020, 18:39 UTC · re: Abhishek Kumar · lore

Re: [RFC PATCH 0/6] various documentation bits

Abhishek Kumar <abhishekkumar8222@gmail.com> writes:
Show 14 quoted lines
> Some general notes about your patch series:
>
> 1. Conventionally, we prefix the first line with "area: " where the area
> is a filename or identifier for general area of the code being modified.
> It's customary to start the remainder of the first line after "area: "
> with a lower-case letter.
>
> For example, your commit titles could have been:
> - doc: tell the glossary about core.hooksPath
> - doc: add bit on extending git to hacking Git
>
> and so on.
>
> Check out SubmittingPatches for more information.
Good suggestion.
Show 5 quoted lines
> 2. We generally don't have a line like in our patches:
>
>> From Kenneth Lorber <keni@his.com>
>
> Between the author information and the signed-off-by, it's redundant.
Carefully inspect the e-mail header and in-body header ;-)  

The author identity must match the identity written for the signed-off-by trailer, so the in-body header becomes needed when the From: e-mail header does not match the true author, like these patches.

> 3. You could probably join the patches 3 to 6 together. Or maybe
> introduce namespace-collisions.txt in third patch and add
> references in all other files in a new, fourth patch.

Perhaps, but I'd rather not to see a rule that hasn't been applied even once in the real situation written down like a law. I'd prefer to see us gain experience by interacting tool authors on the list and learn what their concerns and pain-points are.

Thansk.
Kenneth Lorber· May 18, 2020, 23:44 UTC · re: Junio C Hamano · lore

Re: [RFC PATCH 0/6] various documentation bits

Show 33 quoted lines
> On May 17, 2020, at 2:39 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 
> Abhishek Kumar <abhishekkumar8222@gmail.com> writes:
> 
>> Some general notes about your patch series:
>> 
>> 1. Conventionally, we prefix the first line with "area: " where the area
>> is a filename or identifier for general area of the code being modified.
>> It's customary to start the remainder of the first line after "area: "
>> with a lower-case letter.
>> 
>> For example, your commit titles could have been:
>> - doc: tell the glossary about core.hooksPath
>> - doc: add bit on extending git to hacking Git
>> 
>> and so on.
>> 
>> Check out SubmittingPatches for more information.
> 
> Good suggestion.
> 
>> 2. We generally don't have a line like in our patches:
>> 
>>> From Kenneth Lorber <keni@his.com>
>> 
>> Between the author information and the signed-off-by, it's redundant.
> 
> Carefully inspect the e-mail header and in-body header ;-)  
> 
> The author identity must match the identity written for the
> signed-off-by trailer, so the in-body header becomes needed
> when the From: e-mail header does not match the true author,
> like these patches.
Email/git send-email configuration issue.  They should match on v2, if I'm lucky.
Show 9 quoted lines
> 
>> 3. You could probably join the patches 3 to 6 together. Or maybe
>> introduce namespace-collisions.txt in third patch and add
>> references in all other files in a new, fourth patch.
> 
> Perhaps, but I'd rather not to see a rule that hasn't been applied
> even once in the real situation written down like a law.  I'd prefer
> to see us gain experience by interacting tool authors on the list
> and learn what their concerns and pain-points are.
This tool author/git admin went for a patch to discuss.
I assume from the above there has been no interaction before, so at the very least we need a pointer to the list for this topic to cause that interaction to occur.
As I noted in another part of this thread, we can certainly make it less of a law and more of a recommendation or hint.
I listed some of the issues elsewhere; if that isn't quite what you are looking for I can expand on it.
> 
> Thansk.

Thank you, Keni

Kenneth Lorber· May 18, 2020, 15:45 UTC · re: Abhishek Kumar · lore

Re: [RFC PATCH 0/6] various documentation bits

> On May 17, 2020, at 3:42 AM, Abhishek Kumar <abhishekkumar8222@gmail.com> wrote:
> 
> Hello Kenneth,
Hello.  Thanks for taking the time to assist me.  I am gradually working through all the replies.
Show 50 quoted lines
> 
> On Sat, May 16, 2020 at 10:13:38PM -0400, Kenneth Lorber wrote:
>> From: Kenneth Lorber <keni@his.com>
>> 
>> This started as an effort to understand this section of config.txt:
>>  When inventing new variables for use in your own tool, make sure their
>>  names do not conflict with those that are used by Git itself and
>>  other popular tools, and describe them in your documentation.
>> and grew from there.
>> 
>> I don't expect this to be adopted as is, but I've found it much easier
>> to discuss something concrete rather than an abstract "this is
>> incomplete" or "this is hard to find."
>> 
>> Cut from master.
>> 
>> keni (6):
>>  Tell the glossary about core.hooksPath
>>  Add bit on extending git to Hacking Git
>>  Add namespace collision avoidance guidelines file
>>  Include NAMESPACE COLLISIONS doc into gitrepository-layout.txt
>>  Tell config.txt about NAMESPACE COLLISIONS
>>  Add NAMESPACE COLLISIONS reference to Hacking Git
>> 
>> Documentation/config.txt                      |  4 +-
>> Documentation/gitrepository-layout.txt        |  2 +
>> Documentation/glossary-content.txt            | 10 ++-
>> .../technical/namespace-collisions.txt        | 86 +++++++++++++++++++
>> Documentation/user-manual.txt                 |  9 ++
>> 5 files changed, 106 insertions(+), 5 deletions(-)
>> create mode 100644 Documentation/technical/namespace-collisions.txt
>> 
>> -- 
>> 2.17.1
>> 
> 
> Some general notes about your patch series:
> 
> 1. Conventionally, we prefix the first line with "area: " where the area
> is a filename or identifier for general area of the code being modified.
> It's customary to start the remainder of the first line after "area: "
> with a lower-case letter.
> 
> For example, your commit titles could have been:
> - doc: tell the glossary about core.hooksPath
> - doc: add bit on extending git to hacking Git
> 
> and so on.
> 
> Check out SubmittingPatches for more information.

Got it. I was working from MyFirstContribution.txt which says only: "Start the commit with a 50-column or less subject line, including the name of the component you're working on". If this is a common mistake, perhaps I should take a shot at expanding this a bit?

> 
> 2. We generally don't have a line like in our patches:
> 
>> From Kenneth Lorber <keni@his.com>

That's odd. It's not in the raw 0000-cover-letter.patch file. In response to a comment in another email I've been tweaking both config sendemail.* and my system mailer config and I can't reproduce it (although I see it in a test message from a couple days ago). Hopefully that means it's fixed.

Show 6 quoted lines
> 
> Between the author information and the signed-off-by, it's redundant.
> 
> 3. You could probably join the patches 3 to 6 together. Or maybe
> introduce namespace-collisions.txt in third patch and add references in
> all other files in a new, fourth patch.

I split it out because 6 deepends on 3, but also conflicts with 2 if 3 is rejected. I have no objections to this change once the dust settles but I'd prefer not to reorganize things until then. If you feel strongly the other way I'll change it now.

> 
> Thanks for the contribution!
You're welcome.
> 
> Regards
> Abhishek
Kenneth Lorber· May 25, 2020, 23:27 UTC · re: Kenneth Lorber · lore

[RFC PATCH v2 0/6] various documentation bits

Major changes since v1:
- add "doc:" prefix to subjects
- make guidelines file less authoritative; delete $ID concept
and hopefully fix the conflict between my mailer and my git
configuration which resulted in the extra From: line in the body.
Kenneth Lorber (6):
  doc: Tell the glossary about core.hooksPath
  doc: Add bit on extending git to Hacking Git
  doc: Add namespace collision guidelines file
  doc: Add collision doc to gitrepository-layout.txt
  doc: Tell config.txt about namespace collisions
  doc: Add collision reference to Hacking Git
 Documentation/config.txt                      |  4 +-
 Documentation/gitrepository-layout.txt        |  2 +
 Documentation/glossary-content.txt            | 10 +--
 .../technical/namespace-collisions.txt        | 72 +++++++++++++++++++
 Documentation/user-manual.txt                 |  9 +++
 5 files changed, 92 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/technical/namespace-collisions.txt
-- 
2.17.1
Kenneth Lorber· May 25, 2020, 23:27 UTC · re: Kenneth Lorber · lore

[RFC PATCH v2 6/6] doc: Add collision reference to Hacking Git

Signed-off-by: Kenneth Lorber <keni@his.com>
---
 Documentation/user-manual.txt | 1 +
 1 file changed, 1 insertion(+)
Show changes to Documentation/user-manual.txt +1 −0
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 2144246444..4ceba4a943 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -4056,6 +4056,7 @@ documents may be what you are really looking for:
 * hooks: linkgit:githooks[5]
 * attributes: linkgit:gitattributes[5]
 * new tools: linkgit:git-sh-setup[1]
+* avoiding namespace collisions: linkgit:gitrepository-layout[5]
 
 [[object-details]]
 === Object storage format
-- 
2.17.1
Kenneth Lorber· May 25, 2020, 23:27 UTC · re: Kenneth Lorber · lore

[RFC PATCH v2 2/6] doc: Add bit on extending git to Hacking Git

The Hacking Git section of the user manual is the logical place to look for information on extending Gut, so add a short section of links to places where that information actually lives.

Signed-off-by: Kenneth Lorber <keni@his.com>
---
 Documentation/user-manual.txt | 8 ++++++++
 1 file changed, 8 insertions(+)
Show changes to Documentation/user-manual.txt +8 −0
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 833652983f..2144246444 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -4049,6 +4049,14 @@ and that is what higher level `git merge -s resolve` is implemented with.
 This chapter covers internal details of the Git implementation which
 probably only Git developers need to understand.
 
+If you are extending Git using hooks, writing new tools, or otherwise
+looking for technical information but not hacking Git itself, the following
+documents may be what you are really looking for:
+
+* hooks: linkgit:githooks[5]
+* attributes: linkgit:gitattributes[5]
+* new tools: linkgit:git-sh-setup[1]
+
 [[object-details]]
 === Object storage format
 
-- 
2.17.1
Kenneth Lorber· May 25, 2020, 23:27 UTC · re: Kenneth Lorber · lore

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

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>
---
 .../technical/namespace-collisions.txt        | 72 +++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/technical/namespace-collisions.txt
Show changes to Documentation/technical/namespace-collisions.txt +72 −0
diff --git a/Documentation/technical/namespace-collisions.txt b/Documentation/technical/namespace-collisions.txt
new file mode 100644
index 0000000000..2a0cb312c5
--- /dev/null
+++ b/Documentation/technical/namespace-collisions.txt
@@ -0,0 +1,72 @@
+NAMESPACE COLLISIONS
+--------------------
+(Note that the recommendations in this section are under development
+and subject to change.  At this point they should be considered only
+suggestions.  If they do not work for your use case, or you are considering
+distributing your extension widely, please send a note to the mailing list.)
+
+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_`
+
+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
Junio C Hamano· May 28, 2020, 18:49 UTC · re: Kenneth Lorber · lore

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

Kenneth Lorber <keni@his.com> writes:
Show 8 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

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.

> +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.
> +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.

> +* 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. For the same reason, reserving attributes for individual repositories does not make much sense, either.

> +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.

> +* 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.

> +Names reserved for the lowest level group of people:
What's lowest level group of people?
Also, where did the guideline for third-party tools go?

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.
Junio C Hamano· May 28, 2020, 19:29 UTC · re: Junio C Hamano · lore

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

Junio C Hamano <gitster@pobox.com> writes:
Show 18 quoted lines
> 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.

Also names of worktrees that are attached to a single repository. If a third-party tool wants to make it "easy" for its users by automatically taking a name to do its job (instead of forcing the users to come up with a name and giving it to the tool), the name must be chosen in such a way that it does not collide names in use and names the user (or other third-party tools) will pick in the future.

I (or others) may come up with other things that must be named and name collisions must be avoided. Even though I already said that I didn't think the "suggestions to avoid name collisions" given by the RFC PATCH are well done, I do think it is worth being aware of the problem space, and enumerating what kind of names are shared and limited resource is the first step to become so.

Thanks.
Junio C Hamano· May 29, 2020, 01:20 UTC · re: Junio C Hamano · lore

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

Junio C Hamano <gitster@pobox.com> writes:
Show 12 quoted lines
>> The names of the subcommands "git" can spawn is a shared resource.
>> ...
>
> Also names of worktrees that are attached to a single repository.
> ...
>
> I (or others) may come up with other things that must be named and
> name collisions must be avoided.  Even though I already said that I
> didn't think the "suggestions to avoid name collisions" given by the
> RFC PATCH are well done, I do think it is worth being aware of the
> problem space, and enumerating what kind of names are shared and
> limited resource is the first step to become so.
Here are a few more.
 - The nickname of a remote, like 'origin'.
 - A custom pretty format alias 'pretty.<name>'.
 - Ref hierarchy name (next to refs/{heads,tags,remotes}).

All of these are defined in the configuration, and unlike attributes, they are never defined by in-tree tracked files, so we do not have to worry about "I use this name, and I want to make sure others do not use the same for different purpose."

But third-party tools may want to carve out a subnamespace for their own use, and there needs coordination among them so that they do not stomp on each other's toes, or collide with names the end-users would want to use.

Junio C Hamano· May 29, 2020, 18:08 UTC · re: Junio C Hamano · lore

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

Junio C Hamano <gitster@pobox.com> writes:
Show 25 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>>> The names of the subcommands "git" can spawn is a shared resource.
>>> ...
>>
>> Also names of worktrees that are attached to a single repository.
>> ...
>>
>> I (or others) may come up with other things that must be named and
>> name collisions must be avoided.  Even though I already said that I
>> didn't think the "suggestions to avoid name collisions" given by the
>> RFC PATCH are well done, I do think it is worth being aware of the
>> problem space, and enumerating what kind of names are shared and
>> limited resource is the first step to become so.
>
> Here are a few more.
>
>  - The nickname of a remote, like 'origin'.
>  - A custom pretty format alias 'pretty.<name>'.
>  - Ref hierarchy name (next to refs/{heads,tags,remotes}).
>
> All of these are defined in the configuration, and unlike
> attributes, they are never defined by in-tree tracked files, so we
> do not have to worry about "I use this name, and I want to make sure
> others do not use the same for different purpose."  

Actually "git fetch --mirror" would propagate "private/custom" refnames used by the other side to anybody, so it does pose "I use this name, and my use of this name may harm others who may want to use it for other purposes" issue.

> But third-party tools may want to carve out a subnamespace for their
> own use, and there needs coordination among them so that they do not
> stomp on each other's toes, or collide with names the end-users
> would want to use.
Kenneth Lorber· Jun 1, 2020, 23:55 UTC · re: Junio C Hamano · lore

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

Show 30 quoted lines
> On May 28, 2020, at 3:29 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 
> Junio C Hamano <gitster@pobox.com> writes:
> 
>> 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.
> 
> Also names of worktrees that are attached to a single repository.
> If a third-party tool wants to make it "easy" for its users by
> automatically taking a name to do its job (instead of forcing the
> users to come up with a name and giving it to the tool), the name
> must be chosen in such a way that it does not collide names in use
> and names the user (or other third-party tools) will pick in the
> future.

One more, but only as an issue to be documented - you don't need to convince me that trying to handle this should simply be declared "left as an exercise for the reader" and that's extensions that require being compiled in to git (so file names, global variables, functions, test names, etc).

I'd propose "Do something similar to the above or ask for help on the list" if that's acceptable (where "above" is whatever the current proposal turns into).

Show 7 quoted lines
> 
> I (or others) may come up with other things that must be named and
> name collisions must be avoided.  Even though I already said that I
> didn't think the "suggestions to avoid name collisions" given by the
> RFC PATCH are well done, I do think it is worth being aware of the
> problem space, and enumerating what kind of names are shared and
> limited resource is the first step to become so.

Each message seems less enthusiastic than the last. I'm not sure I see any point in creating a v3 until I have time and inspiration to write something significantly different.

> 
> Thanks.
You're welcome.
PS - nothing to reply to in the next 2 messages from you.  Saved them for v3.
Kenneth Lorber· Jun 1, 2020, 18:38 UTC · re: Junio C Hamano · lore

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

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.

Kenneth Lorber· May 25, 2020, 23:27 UTC · re: Kenneth Lorber · lore

[RFC PATCH v2 4/6] doc: Add collision doc to gitrepository-layout.txt

Signed-off-by: Kenneth Lorber <keni@his.com>
---
 Documentation/gitrepository-layout.txt | 2 ++
 1 file changed, 2 insertions(+)
Show changes to Documentation/gitrepository-layout.txt +2 −0
diff --git a/Documentation/gitrepository-layout.txt b/Documentation/gitrepository-layout.txt
index 1a2ef4c150..8050e8cc1f 100644
--- a/Documentation/gitrepository-layout.txt
+++ b/Documentation/gitrepository-layout.txt
@@ -292,6 +292,8 @@ worktrees/<id>/config.worktree::
 
 include::technical/repository-version.txt[]
 
+include::technical/namespace-collisions.txt[]
+
 SEE ALSO
 --------
 linkgit:git-init[1],
-- 
2.17.1
Kenneth Lorber· May 25, 2020, 23:27 UTC · re: Kenneth Lorber · lore

[RFC PATCH v2 1/6] doc: Tell the glossary about core.hooksPath

The user manual glossary entry for hooks now knows about core.hooksPath.
Signed-off-by: Kenneth Lorber <keni@his.com>
---
 Documentation/glossary-content.txt | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
Show changes to Documentation/glossary-content.txt +6 −4
diff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt
index 090c888335..37147db1bc 100644
--- a/Documentation/glossary-content.txt
+++ b/Documentation/glossary-content.txt
@@ -206,10 +206,12 @@ for a more flexible and robust system to do the same thing.
 	to optional scripts that allow a developer to add functionality or
 	checking. Typically, the hooks allow for a command to be pre-verified
 	and potentially aborted, and allow for a post-notification after the
-	operation is done. The hook scripts are found in the
-	`$GIT_DIR/hooks/` directory, and are enabled by simply
-	removing the `.sample` suffix from the filename. In earlier versions
-	of Git you had to make them executable.
+	operation is done. The hook scripts are found in `$GIT_DIR/hooks/`
+	or in any directory specified by the `core.hooksPath` configuration
+	variable.  The sample scripts are enabled by simply
+	removing the `.sample` suffix from the filename.  In earlier versions
+	of Git you had to make the sample scripts executable manually.
+	Hook scripts must be executable.  See linkgit:githooks[5] for details.
 
 [[def_index]]index::
 	A collection of files with stat information, whose contents are stored
-- 
2.17.1
Junio C Hamano· May 26, 2020, 18:59 UTC · re: Kenneth Lorber · lore

Re: [RFC PATCH v2 1/6] doc: Tell the glossary about core.hooksPath

Kenneth Lorber <keni@his.com> writes:
> Subject: Re: [RFC PATCH v2 1/6] doc: Tell the glossary about core.hooksPath
Perhaps
    Subject: [PATCH] glossary: describe core.hooksPath

Please separate this one patch out and send it again without the rest of the series, as this is quite different from the rest of the 6-patch series and an obvious clarification, unlike the others.

Show 5 quoted lines
> -	operation is done. The hook scripts are found in the
> -	`$GIT_DIR/hooks/` directory, and are enabled by simply
> -	removing the `.sample` suffix from the filename. In earlier versions
> -	of Git you had to make them executable.
> +	operation is done. The hook scripts are found in `$GIT_DIR/hooks/`

You accidentally lost 'the', and because you did an unnecessary line-wrapping, such a change became harder to spot.

I am not sure if .sample scripts should be a topioc of this glossary entry at all to begin with. And I think it outlived the usefulness to describe what was in versions of Git that is more than 10 years old. I wonder if it is a better idea to take your new description, but remove everything after "The sample scripts are enabled..." except for the "see ... for details" link?

Show 5 quoted lines
> +	or in any directory specified by the `core.hooksPath` configuration
> +	variable.  The sample scripts are enabled by simply
> +	removing the `.sample` suffix from the filename.  In earlier versions
> +	of Git you had to make the sample scripts executable manually.
> +	Hook scripts must be executable.  See linkgit:githooks[5] for details.
>  [[def_index]]index::
>  	A collection of files with stat information, whose contents are stored
Kenneth Lorber· May 27, 2020, 16:52 UTC · re: Junio C Hamano · lore

Re: [RFC PATCH v2 1/6] doc: Tell the glossary about core.hooksPath

Show 13 quoted lines
> On May 26, 2020, at 2:59 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 
> Kenneth Lorber <keni@his.com> writes:
> 
>> Subject: Re: [RFC PATCH v2 1/6] doc: Tell the glossary about core.hooksPath
> 
> Perhaps
> 
>    Subject: [PATCH] glossary: describe core.hooksPath
> 
> Please separate this one patch out and send it again without the
> rest of the series, as this is quite different from the rest of the
> 6-patch series and an obvious clarification, unlike the others.
Will do.
Show 9 quoted lines
> 
>> -	operation is done. The hook scripts are found in the
>> -	`$GIT_DIR/hooks/` directory, and are enabled by simply
>> -	removing the `.sample` suffix from the filename. In earlier versions
>> -	of Git you had to make them executable.
>> +	operation is done. The hook scripts are found in `$GIT_DIR/hooks/`
> 
> You accidentally lost 'the', and because you did an unnecessary
> line-wrapping, such a change became harder to spot.  
My apologies.
Show 7 quoted lines
> 
> I am not sure if .sample scripts should be a topioc of this glossary
> entry at all to begin with.  And I think it outlived the usefulness
> to describe what was in versions of Git that is more than 10 years
> old.  I wonder if it is a better idea to take your new description,
> but remove everything after "The sample scripts are enabled..."
> except for the "see ... for details" link?

I had considered it but didn't want to presume. If I don't hear any objections I will take it out.

Show 9 quoted lines
> 
>> +	or in any directory specified by the `core.hooksPath` configuration
>> +	variable.  The sample scripts are enabled by simply
>> +	removing the `.sample` suffix from the filename.  In earlier versions
>> +	of Git you had to make the sample scripts executable manually.
>> +	Hook scripts must be executable.  See linkgit:githooks[5] for details.
> 
>> [[def_index]]index::
>> 	A collection of files with stat information, whose contents are stored
Kenneth Lorber· May 27, 2020, 17:18 UTC · re: Kenneth Lorber · lore

Re: [RFC PATCH v2 1/6] doc: Tell the glossary about core.hooksPath

Show 31 quoted lines
> On May 27, 2020, at 12:52 PM, Kenneth Lorber <keni@his.com> wrote:
> 
> 
> 
>> On May 26, 2020, at 2:59 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> 
>> Kenneth Lorber <keni@his.com> writes:
>> 
>>> Subject: Re: [RFC PATCH v2 1/6] doc: Tell the glossary about core.hooksPath
>> 
>> Perhaps
>> 
>>   Subject: [PATCH] glossary: describe core.hooksPath
>> 
>> Please separate this one patch out and send it again without the
>> rest of the series, as this is quite different from the rest of the
>> 6-patch series and an obvious clarification, unlike the others.
> 
> Will do.
> 
>> 
>>> -	operation is done. The hook scripts are found in the
>>> -	`$GIT_DIR/hooks/` directory, and are enabled by simply
>>> -	removing the `.sample` suffix from the filename. In earlier versions
>>> -	of Git you had to make them executable.
>>> +	operation is done. The hook scripts are found in `$GIT_DIR/hooks/`
>> 
>> You accidentally lost 'the', and because you did an unnecessary
>> line-wrapping, such a change became harder to spot.  
> 
> My apologies.

I just read this section a couple more times and I think the dropped "the" is correct since the sentence structure has changed.

The sentence in question, unwrapped: The hook scripts are found in `$GIT_DIR/hooks/` or in any directory specified by the `core.hooksPath` configuration variable.

It might deserve some additional changes though, since the above vaguely implies both locations are checked, which is incorrect. Perhaps this is more accurate: The hook scripts are found in the directory specified by the `core.hooksPath` configuration variable; the default location is `$GIT_DIR/hooks/`.

Show 22 quoted lines
> 
>> 
>> I am not sure if .sample scripts should be a topioc of this glossary
>> entry at all to begin with.  And I think it outlived the usefulness
>> to describe what was in versions of Git that is more than 10 years
>> old.  I wonder if it is a better idea to take your new description,
>> but remove everything after "The sample scripts are enabled..."
>> except for the "see ... for details" link?
> 
> I had considered it but didn't want to presume.  If I don't hear any objections
> I will take it out.
> 
>> 
>>> +	or in any directory specified by the `core.hooksPath` configuration
>>> +	variable.  The sample scripts are enabled by simply
>>> +	removing the `.sample` suffix from the filename.  In earlier versions
>>> +	of Git you had to make the sample scripts executable manually.
>>> +	Hook scripts must be executable.  See linkgit:githooks[5] for details.
>> 
>>> [[def_index]]index::
>>> 	A collection of files with stat information, whose contents are stored
> 
Junio C Hamano· May 27, 2020, 17:18 UTC · re: Kenneth Lorber · lore

Re: [RFC PATCH v2 1/6] doc: Tell the glossary about core.hooksPath

Kenneth Lorber <keni@his.com> writes:
Show 9 quoted lines
>> I am not sure if .sample scripts should be a topioc of this glossary
>> entry at all to begin with.  And I think it outlived the usefulness
>> to describe what was in versions of Git that is more than 10 years
>> old.  I wonder if it is a better idea to take your new description,
>> but remove everything after "The sample scripts are enabled..."
>> except for the "see ... for details" link?
>
> I had considered it but didn't want to presume.  If I don't hear any objections
> I will take it out.

If it is not too much trouble, it probably is a better organization to make this a two-patch series, whose first patch leaves the original description on .sample files in, and the second patch that builds on top of the first patch removes the description on .sample files. That way, if people still likes to see the description on .sample, we can just drop the second patch and still use the first patch.

Thanks.
Kenneth Lorber· May 25, 2020, 23:27 UTC · re: Kenneth Lorber · lore

[RFC PATCH v2 5/6] doc: Tell config.txt about namespace collisions

Add a link to the namespace collisions information where git help config only mentioned the issue without supplying any guidance for how to do that.

Signed-off-by: Kenneth Lorber <keni@his.com>
---
 Documentation/config.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Show changes to Documentation/config.txt +3 −1
diff --git a/Documentation/config.txt b/Documentation/config.txt
index ef0768b91a..1e819c26f0 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -310,7 +310,9 @@ in the appropriate manual page.
 Other git-related tools may and do use their own variables.  When
 inventing new variables for use in your own tool, make sure their
 names do not conflict with those that are used by Git itself and
-other popular tools, and describe them in your documentation.
+other popular tools, and describe them in your documentation.  See
+'NAMESPACE COLLISIONS' in linkgit:gitrepository-layout[5] for guidelines
+to prevent such conflicts.
 
 include::config/advice.txt[]
 
-- 
2.17.1
Kenneth Lorber· May 31, 2020, 21:37 UTC · re: Kenneth Lorber · lore

[RFC PATCH 0/2] update glossary hooks entry

Per Junio C Hamano, extract and split v2-0001-doc-Tell-the-glossary-about-core.hooksPath.patch from the series starting with [RFC PATCH v2 0/6] various documentation bits.

Kenneth Lorber (2):
  doc: Tell the glossary about core.hooksPath
  doc: remove dated info and refs to sample hooks
 Documentation/glossary-content.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
-- 
2.17.1
Kenneth Lorber· May 31, 2020, 21:37 UTC · re: Kenneth Lorber · lore

[RFC PATCH 1/2] doc: Tell the glossary about core.hooksPath

Signed-off-by: Kenneth Lorber <keni@his.com>
---
 Documentation/glossary-content.txt | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Show changes to Documentation/glossary-content.txt +5 −4
diff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt
index 090c888335..a8490830ff 100644
--- a/Documentation/glossary-content.txt
+++ b/Documentation/glossary-content.txt
@@ -206,10 +206,11 @@ for a more flexible and robust system to do the same thing.
 	to optional scripts that allow a developer to add functionality or
 	checking. Typically, the hooks allow for a command to be pre-verified
 	and potentially aborted, and allow for a post-notification after the
-	operation is done. The hook scripts are found in the
-	`$GIT_DIR/hooks/` directory, and are enabled by simply
-	removing the `.sample` suffix from the filename. In earlier versions
-	of Git you had to make them executable.
+	operation is done. The hook scripts are found in
+	`$GIT_DIR/hooks/` or in any directory specified by the `core.hooksPath`
+	configuration variable.  The sample scripts are enabled by simply
+	removing the `.sample` suffix from the filename.  In earlier versions
+	of Git you had to make them executable.  See linkgit:githooks[5] for details.
 
 [[def_index]]index::
 	A collection of files with stat information, whose contents are stored
-- 
2.17.1
Kenneth Lorber· May 31, 2020, 21:37 UTC · re: Kenneth Lorber · lore

[RFC PATCH 2/2] doc: remove dated info and refs to sample hooks

In the glossary entry for hooks:
- don't discuss renaming the sample hooks
- don't discuss the need to make the sample hooks executable as the existing
  wording is too specific: it implies only the sample hooks need to be executable
  and the need to make scripts executable is already discussed near the top of hooks(5).
Signed-off-by: Kenneth Lorber <keni@his.com>
---
 Documentation/glossary-content.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Show changes to Documentation/glossary-content.txt +2 −3
diff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt
index a8490830ff..d96b25bef3 100644
--- a/Documentation/glossary-content.txt
+++ b/Documentation/glossary-content.txt
@@ -208,9 +208,8 @@ for a more flexible and robust system to do the same thing.
 	and potentially aborted, and allow for a post-notification after the
 	operation is done. The hook scripts are found in
 	`$GIT_DIR/hooks/` or in any directory specified by the `core.hooksPath`
-	configuration variable.  The sample scripts are enabled by simply
-	removing the `.sample` suffix from the filename.  In earlier versions
-	of Git you had to make them executable.  See linkgit:githooks[5] for details.
+	configuration variable.
+	See linkgit:githooks[5] for details.
 
 [[def_index]]index::
 	A collection of files with stat information, whose contents are stored
-- 
2.17.1

← back to recent threads