diff options
Diffstat (limited to 'builtin/rev-parse.c')
-rw-r--r-- | builtin/rev-parse.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index d85e08cc9c..c911b456de 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -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")) { |