Git Mailing List Archive on lore.kernel.org
 help / color / Atom feed
From: Kenneth Lorber <keni@hers.com>
To: git@vger.kernel.org
Cc: keni@hers.com
Subject: [RFC PATCH 3/6] Add namespace collision avoidance guidelines file
Date: Sat, 16 May 2020 22:13:41 -0400
Message-ID: <1589681624-36969-4-git-send-email-keni@hers.com> (raw)
In-Reply-To: <1589681624-36969-1-git-send-email-keni@hers.com>

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

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


  parent reply index

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17  2:13 [RFC PATCH 0/6] various documentation bits Kenneth Lorber
2020-05-17  2:13 ` [RFC PATCH 1/6] Tell the glossary about core.hooksPath Kenneth Lorber
2020-05-17 18:33   ` Junio C Hamano
2020-05-18 22:06     ` Kenneth Lorber
2020-05-17  2:13 ` [RFC PATCH 2/6] Add bit on extending git to Hacking Git Kenneth Lorber
2020-05-17 18:34   ` Junio C Hamano
2020-05-18 22:10     ` Kenneth Lorber
2020-05-17  2:13 ` Kenneth Lorber [this message]
2020-05-17  9:45   ` [RFC PATCH 3/6] Add namespace collision avoidance guidelines file Abhishek Kumar
2020-05-18 15:51     ` Kenneth Lorber
2020-05-17 15:31   ` Junio C Hamano
2020-05-18 21:46     ` Kenneth Lorber
2020-05-17  2:13 ` [RFC PATCH 4/6] Include NAMESPACE COLLISIONS doc into gitrepository-layout.txt Kenneth Lorber
2020-05-18  0:26   ` Junio C Hamano
2020-05-18 23:54     ` Kenneth Lorber
2020-05-17  2:13 ` [RFC PATCH 5/6] Tell config.txt about NAMESPACE COLLISIONS Kenneth Lorber
2020-05-18  0:32   ` Junio C Hamano
2020-05-17  2:13 ` [RFC PATCH 6/6] Add NAMESPACE COLLISIONS reference to Hacking Git Kenneth Lorber
2020-05-17  7:42 ` [RFC PATCH 0/6] various documentation bits Abhishek Kumar
2020-05-17 18:39   ` Junio C Hamano
2020-05-18 23:44     ` Kenneth Lorber
2020-05-18 15:45   ` Kenneth Lorber
2020-05-25 23:27 ` [RFC PATCH v2 " Kenneth Lorber
2020-05-25 23:27   ` [RFC PATCH v2 1/6] doc: Tell the glossary about core.hooksPath Kenneth Lorber
2020-05-26 18:59     ` Junio C Hamano
2020-05-27 16:52       ` Kenneth Lorber
2020-05-27 17:18         ` Kenneth Lorber
2020-05-27 17:18         ` Junio C Hamano
2020-05-25 23:27   ` [RFC PATCH v2 2/6] doc: Add bit on extending git to Hacking Git Kenneth Lorber
2020-05-25 23:27   ` [RFC PATCH v2 3/6] doc: Add namespace collision guidelines file Kenneth Lorber
2020-05-28 18:49     ` Junio C Hamano
2020-05-28 19:29       ` Junio C Hamano
2020-05-29  1:20         ` Junio C Hamano
2020-05-29 18:08           ` Junio C Hamano
2020-06-01 23:55         ` Kenneth Lorber
2020-06-01 18:38       ` Kenneth Lorber
2020-05-25 23:27   ` [RFC PATCH v2 4/6] doc: Add collision doc to gitrepository-layout.txt Kenneth Lorber
2020-05-25 23:27   ` [RFC PATCH v2 5/6] doc: Tell config.txt about namespace collisions Kenneth Lorber
2020-05-25 23:27   ` [RFC PATCH v2 6/6] doc: Add collision reference to Hacking Git Kenneth Lorber
2020-05-31 21:37   ` [RFC PATCH 0/2] update glossary hooks entry Kenneth Lorber
2020-05-31 21:37     ` [RFC PATCH 1/2] doc: Tell the glossary about core.hooksPath Kenneth Lorber
2020-05-31 21:37     ` [RFC PATCH 2/2] doc: remove dated info and refs to sample hooks Kenneth Lorber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1589681624-36969-4-git-send-email-keni@hers.com \
    --to=keni@hers.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Mailing List Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/git/0 git/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 git git/ https://lore.kernel.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.git


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git