diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-04-26 08:39:08 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-26 08:39:08 +0200 |
commit | b80f629f5bcf798a3c9b37651d2369ad555e7382 (patch) | |
tree | 0a7ed758d7a74b96cb4bb713dbf66f9362a40b22 /builtin/config.c | |
parent | Merge branch 'jh/add-index-entry-optim' (diff) | |
parent | am: drop "dir" parameter from am_state_init (diff) | |
download | git-b80f629f5bcf798a3c9b37651d2369ad555e7382.tar.xz git-b80f629f5bcf798a3c9b37651d2369ad555e7382.zip |
Merge branch 'jk/war-on-git-path'
While handy, "git_path()" is a dangerous function to use as a
callsite that uses it safely one day can be broken by changes
to other code that calls it. Reduction of its use continues.
* jk/war-on-git-path:
am: drop "dir" parameter from am_state_init
replace strbuf_addstr(git_path()) with git_path_buf()
replace xstrdup(git_path(...)) with git_pathdup(...)
use git_path_* helper functions
branch: add edit_description() helper
bisect: add git_path_bisect_terms helper
Diffstat (limited to 'builtin/config.c')
-rw-r--r-- | builtin/config.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/config.c b/builtin/config.c index 1b7ed5af08..3a554ad50c 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -600,8 +600,9 @@ int cmd_config(int argc, const char **argv, const char *prefix) if (given_config_source.blob) die("editing blobs is not supported"); git_config(git_default_config, NULL); - config_file = xstrdup(given_config_source.file ? - given_config_source.file : git_path("config")); + config_file = given_config_source.file ? + xstrdup(given_config_source.file) : + git_pathdup("config"); if (use_global_config) { int fd = open(config_file, O_CREAT | O_EXCL | O_WRONLY, 0666); if (fd >= 0) { |