setup_git_directory_gently: do not barf when GIT_DIR is given.
authorMatthias Lederhofer <matled@gmx.net>
Sun, 30 Jul 2006 01:30:29 +0000 (03:30 +0200)
committerJunio C Hamano <junkio@cox.net>
Mon, 31 Jul 2006 00:45:57 +0000 (17:45 -0700)
Earlier we barfed when GIT_DIR environment variable points at a
directory yet to be created, which made it impossible to use
configuration mechanism in "git-init-db".

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
setup.c

diff --git a/setup.c b/setup.c
index 4612f110ee0beaeada3cb31ce7d47ad7175eec9c..358e139d84c422a9bd0a9500807a31cbf7695f02 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -184,6 +184,10 @@ const char *setup_git_directory_gently(int *nongit_ok)
                }
                return NULL;
        bad_dir_environ:
+               if (!nongit_ok) {
+                       *nongit_ok = 1;
+                       return NULL;
+               }
                path[len] = 0;
                die("Not a git repository: '%s'", path);
        }