Merge branch 'rs/simplify-config-include'
[gitweb.git] / builtin / rev-parse.c
index d85e08cc9cc22ee307470dbeb12fdd8d1eea655b..c911b456dedd648e36a876c6175c23e1ef028a43 100644 (file)
@@ -736,7 +736,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                        }
                        if (!strcmp(arg, "--git-dir")) {
                                const char *gitdir = getenv(GIT_DIR_ENVIRONMENT);
-                               static char cwd[PATH_MAX];
+                               char *cwd;
                                int len;
                                if (gitdir) {
                                        puts(gitdir);
@@ -746,10 +746,10 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                                        puts(".git");
                                        continue;
                                }
-                               if (!getcwd(cwd, PATH_MAX))
-                                       die_errno("unable to get current working directory");
+                               cwd = xgetcwd();
                                len = strlen(cwd);
                                printf("%s%s.git\n", cwd, len && cwd[len-1] != '/' ? "/" : "");
+                               free(cwd);
                                continue;
                        }
                        if (!strcmp(arg, "--resolve-git-dir")) {