git-config: replace use of home_config_paths()
Since home_config_paths() combines distinct functionality already implemented by expand_user_path() and xdg_config_home(), and hides the home config file path ~/.gitconfig. Make the code more explicit by replacing the use of home_config_paths() with expand_user_path() and xdg_config_home(). Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Paul Tan committed
May 6, 2015 at 16:01 UTC
509adc335274d2656829b18e1e83ccabda059ae3
2 files changed
+4
-8
builtin/config.c
+2
-4
@@ -488,10 +488,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
488
}
489
490
if (use_global_config) {
491
- char *user_config = NULL;
492
- char *xdg_config = NULL;
493
-
494
- home_config_paths(&user_config, &xdg_config, "config");
491
+ char *user_config = expand_user_path("~/.gitconfig");
492
+ char *xdg_config = xdg_config_home("config");
493
494
if (!user_config)
495
/*
config.c
+2
-4
@@ -1180,10 +1180,8 @@ int git_config_system(void)
1180
int git_config_early(config_fn_t fn, void *data, const char *repo_config)
1181
{
1182
int ret = 0, found = 0;
1183
- char *xdg_config = NULL;
1184
- char *user_config = NULL;
1185
-
1186
- home_config_paths(&user_config, &xdg_config, "config");
1183
+ char *xdg_config = xdg_config_home("config");
1184
+ char *user_config = expand_user_path("~/.gitconfig");
1185
1186
if (git_config_system() && !access_or_die(git_etc_gitconfig(), R_OK, 0)) {
1187
ret += git_config_from_file(fn, git_etc_gitconfig(),