]> granicus.if.org Git - git/commitdiff
git-config: replace use of home_config_paths()
authorPaul Tan <pyokagan@gmail.com>
Wed, 6 May 2015 08:01:03 +0000 (16:01 +0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 May 2015 18:33:48 +0000 (11:33 -0700)
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>
builtin/config.c
config.c

index 15a7bea936d667042cef27f83c86a863df2caa8f..2f8bf7d7cfdb36029046c1d5a28af56ad708a9c4 100644 (file)
@@ -488,10 +488,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
        }
 
        if (use_global_config) {
-               char *user_config = NULL;
-               char *xdg_config = NULL;
-
-               home_config_paths(&user_config, &xdg_config, "config");
+               char *user_config = expand_user_path("~/.gitconfig");
+               char *xdg_config = xdg_config_home("config");
 
                if (!user_config)
                        /*
index 752e2e227f56edfb7b2ad168798c110c14a2c5e8..0d7af9eefe1cf6b43cf6e51d258e1e1b2e54c7f1 100644 (file)
--- a/config.c
+++ b/config.c
@@ -1180,10 +1180,8 @@ int git_config_system(void)
 int git_config_early(config_fn_t fn, void *data, const char *repo_config)
 {
        int ret = 0, found = 0;
-       char *xdg_config = NULL;
-       char *user_config = NULL;
-
-       home_config_paths(&user_config, &xdg_config, "config");
+       char *xdg_config = xdg_config_home("config");
+       char *user_config = expand_user_path("~/.gitconfig");
 
        if (git_config_system() && !access_or_die(git_etc_gitconfig(), R_OK, 0)) {
                ret += git_config_from_file(fn, git_etc_gitconfig(),