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)' '
(