setup: allow for prefix to be passed to git commands
[gitweb.git] / setup.c
diff --git a/setup.c b/setup.c
index 967f289f1ef07d78f4b680e1d880e2fa86215371..56cd68ba93c47a64529bb811e21ae7bbbdabb38c 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -939,9 +939,14 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
 
 const char *setup_git_directory_gently(int *nongit_ok)
 {
-       const char *prefix;
+       const char *prefix, *env_prefix;
 
        prefix = setup_git_directory_gently_1(nongit_ok);
+       env_prefix = getenv(GIT_TOPLEVEL_PREFIX_ENVIRONMENT);
+
+       if (env_prefix)
+               prefix = env_prefix;
+
        if (prefix)
                setenv(GIT_PREFIX_ENVIRONMENT, prefix, 1);
        else