Thread (2 messages) 2 messages, 2 authors, 2016-06-15

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

flat view

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:43:31
Subsystem: the rest · Maintainer: Linus Torvalds

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)' '
 
 	(
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help