setup_bare_git_dir(): help static analysis
[gitweb.git] / setup.c
diff --git a/setup.c b/setup.c
index 0309c278218f96cb6b11e6a9d60011efce54cf62..0320a9ad14c9c2e37c8b69e5b86ae0bc3e2adb0c 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -748,7 +748,7 @@ static const char *setup_bare_git_dir(struct strbuf *cwd, int offset,
 
        /* --work-tree is set without --git-dir; use discovered one */
        if (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {
-               const char *gitdir;
+               static const char *gitdir;
 
                gitdir = offset == cwd->len ? "." : xmemdupz(cwd->buf, offset);
                if (chdir(cwd->buf))