Skip to content

Commit

Permalink
git-config: replace use of home_config_paths()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Tan authored and Junio C Hamano committed May 6, 2015
1 parent e682c9d commit 509adc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions builtin/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
/*
Expand Down
6 changes: 2 additions & 4 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 509adc3

Please sign in to comment.