Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-03 00:27:45 +0400
committerJunio C Hamano <gitster@pobox.com>2014-09-03 00:28:44 +0400
commitf655651e09b9fa7bf8ff13f1b4a5b16c7956e4cf (patch)
tree4027a4324f45863de3811cf89df768d584f08e3e /builtin/rev-parse.c
parent51eeaea2108a4105542fe03935b411dfdbf5fe2b (diff)
parent9610decf4dc6b9352b81c67e3b03e5bb47fc8427 (diff)
Merge branch 'rs/strbuf-getcwd'
Reduce the use of fixed sized buffer passed to getcwd() calls by introducing xgetcwd() helper. * rs/strbuf-getcwd: use strbuf_add_absolute_path() to add absolute paths abspath: convert absolute_path() to strbuf use xgetcwd() to set $GIT_DIR use xgetcwd() to get the current directory or die wrapper: add xgetcwd() abspath: convert real_path_internal() to strbuf abspath: use strbuf_getcwd() to remember original working directory setup: convert setup_git_directory_gently_1 et al. to strbuf unix-sockets: use strbuf_getcwd() strbuf: add strbuf_getcwd()
Diffstat (limited to 'builtin/rev-parse.c')
-rw-r--r--builtin/rev-parse.c6
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")) {