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

Re: [PATCH/RFH] Fix initialization of a bare repository

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 27, 2007, 10:54 UTC
Message-ID
<Pine.LNX.4.64.0708271154020.28586@racer.site>
In-Reply-To
<7v7inhmmsx.fsf_-_@gitster.siamese.dyndns.org>
Hi,
how about this on top (or squashed):
-- snipsnap --
 builtin-init-db.c |    4 +++-
 t/t0001-init.sh   |   11 +++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/builtin-init-db.c b/builtin-init-db.c
index ec90b66..af15cb2 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -288,8 +288,10 @@ static void guess_repository_type(const char *git_dir)
 	if (!strcmp(git_dir, cwd))
 		goto force_bare;
 	/*
-	 * "GIT_DIR=something/.git is usually not.
+	 * "GIT_DIR=.git or GIT_DIR=something/.git is usually not.
 	 */
+	if (!strcmp(git_dir, ".git"))
+		return;
 	slash = strrchr(git_dir, '/');
 	if (slash && !strcmp(slash, "/.git"))
 		return;
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 333abb2..b14b3ec 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -79,6 +79,17 @@ test_expect_success 'GIT_DIR bare' '
 	check_config git-dir-bare.git true unset
 '
 
+test_expect_success 'GIT_DIR non-bare' '
+
+	(
+		unset GIT_CONFIG &&
+		mkdir non-bare &&
+		cd non-bare &&
+		GIT_DIR=.git git init
+	) &&
+	check_config non-bare/.git false unset
+'
+
 test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' '
 
 	(
Previous: Junio C Hamano
Message 8 of 8 in “git clone regression”
  1. Junio C HamanoAug 15, 2007
  2. Fix initialization of a bare repositoryJohannes Schindelin, Aug 15, 2007
  3. Junio C HamanoAug 15, 2007
  4. Junio C HamanoAug 15, 2007
  5. Junio C HamanoAug 15, 2007
  6. Johannes SchindelinAug 17, 2007
  7. Fix initialization of a bare repositoryJunio C Hamano, Aug 27, 2007
  8. Johannes SchindelinAug 27, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.