Skip to content

Commit 509adc3

Browse files
pyokagangitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e682c9d commit 509adc3

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

builtin/config.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
488488
}
489489

490490
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");
495493

496494
if (!user_config)
497495
/*

config.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,10 +1180,8 @@ int git_config_system(void)
11801180
int git_config_early(config_fn_t fn, void *data, const char *repo_config)
11811181
{
11821182
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");
11871185

11881186
if (git_config_system() && !access_or_die(git_etc_gitconfig(), R_OK, 0)) {
11891187
ret += git_config_from_file(fn, git_etc_gitconfig(),

0 commit comments

Comments
 (0)