diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-09-02 13:27:45 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-09-02 13:28:44 -0700 |
commit | f655651e09b9fa7bf8ff13f1b4a5b16c7956e4cf (patch) | |
tree | 4027a4324f45863de3811cf89df768d584f08e3e /trace.c | |
parent | 51eeaea2108a4105542fe03935b411dfdbf5fe2b (diff) | |
parent | 9610decf4dc6b9352b81c67e3b03e5bb47fc8427 (diff) | |
download | git-f655651e09b9fa7bf8ff13f1b4a5b16c7956e4cf.tar.gz |
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 'trace.c')
-rw-r--r-- | trace.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -298,13 +298,12 @@ void trace_repo_setup(const char *prefix) { static struct trace_key key = TRACE_KEY_INIT(SETUP); const char *git_work_tree; - char cwd[PATH_MAX]; + char *cwd; if (!trace_want(&key)) return; - if (!getcwd(cwd, PATH_MAX)) - die("Unable to get current working directory"); + cwd = xgetcwd(); if (!(git_work_tree = get_git_work_tree())) git_work_tree = "(null)"; @@ -316,6 +315,8 @@ void trace_repo_setup(const char *prefix) trace_printf_key(&key, "setup: worktree: %s\n", quote_crnl(git_work_tree)); trace_printf_key(&key, "setup: cwd: %s\n", quote_crnl(cwd)); trace_printf_key(&key, "setup: prefix: %s\n", quote_crnl(prefix)); + + free(cwd); } int trace_want(struct trace_key *key) |