]> git.ipfire.org Git - thirdparty/git.git/blobdiff - setup.c
split_commit_in_progress(): simplify & fix memory leak
[thirdparty/git.git] / setup.c
diff --git a/setup.c b/setup.c
index 5c7946d2b45f067049e11347cca1cedc9790e228..0309c278218f96cb6b11e6a9d60011efce54cf62 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -987,7 +987,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
 {
        static struct strbuf cwd = STRBUF_INIT;
        struct strbuf dir = STRBUF_INIT, gitdir = STRBUF_INIT;
-       const char *prefix;
+       const char *prefix, *env_prefix;
 
        /*
         * We may have read an incomplete configuration before
@@ -1045,6 +1045,10 @@ const char *setup_git_directory_gently(int *nongit_ok)
                die("BUG: unhandled setup_git_directory_1() result");
        }
 
+       env_prefix = getenv(GIT_TOPLEVEL_PREFIX_ENVIRONMENT);
+       if (env_prefix)
+               prefix = env_prefix;
+
        if (prefix)
                setenv(GIT_PREFIX_ENVIRONMENT, prefix, 1);
        else