threads / patch / 27698

patchDocumentation: Clarify guessing of core.bare

Subject: [PATCH] Documentation: Clarify guessing of core.bare

## tl;dr

One message between Jun 24, 2011 and Jun 24, 2011. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Christof Krüger· Jun 24, 2011, 14:43 UTC · lore

Make clear that core.bare is guessed based on GIT_DIR only and not on what is optionally specified as a directory on the command line.

While "git init test.git" creates a non-bare repo in "test.git/.git", "GIT_DIR=test.git git init" creates a bare repo in "test.git".

Also mention guessing of core.bare in the documentation of "git init" and "git clone".

Signed-off-by: Christof Krüger <git@christof-krueger.de>
---
 Documentation/config.txt    |    8 ++++----
 Documentation/git-clone.txt |    4 +++-
 Documentation/git-init.txt  |    6 ++++--
 3 files changed, 11 insertions(+), 7 deletions(-)
Show changes to 3 files +11 −7

Documentation/config.txt, Documentation/git-clone.txt, Documentation/git-init.txt

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 6b93777..c44c112 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -311,10 +311,10 @@ core.bare::
 	disabled, such as linkgit:git-add[1] or linkgit:git-merge[1].
 +
 This setting is automatically guessed by linkgit:git-clone[1] or
-linkgit:git-init[1] when the repository was created.  By default a
-repository that ends in "/.git" is assumed to be not bare (bare =
-false), while all other repositories are assumed to be bare (bare
-= true).
+linkgit:git-init[1] when the repository was created.  By
+default, a bare repository is assumed if the last directory
+component in the GIT_DIR environment variable differs from
+".git".
 
 core.worktree::
 	Set the path to the root of the working tree.
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index b093e45..4a5af49 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -127,7 +127,9 @@ objects from the source repository into a pack in the cloned repository.
 	to corresponding local branch heads, without mapping
 	them to `refs/remotes/origin/`.  When this option is
 	used, neither remote-tracking branches nor the related
-	configuration variables are created.
+	configuration variables are created.  Setting GIT_DIR to
+	a path whose last directory component is different from
+	".git" implies --bare.
 
 --mirror::
 	Set up a mirror of the source repository.  This implies `--bare`.
diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt
index f2777a7..ba3979c 100644
--- a/Documentation/git-init.txt
+++ b/Documentation/git-init.txt
@@ -46,8 +46,10 @@ Only print error and warning messages, all other output will be suppressed.
 
 --bare::
 
-Create a bare repository. If GIT_DIR environment is not set, it is set to the
-current working directory.
+Create a bare repository. If the GIT_DIR environment variable is not set, the
+bare repository is created in the current working directory.  Setting GIT_DIR
+to a path whose last directory component is different from ".git" implies
+--bare.
 
 --template=<template_directory>::
 
-- 
1.7.6.rc3.2.g94021

← back to recent threads