Skip to content

Commit

Permalink
home_config_paths(): let the caller ignore xdg path
Browse files Browse the repository at this point in the history
The caller can signal that it is not interested in learning
the location of $HOME/.gitconfig by passing global=NULL, but
there is no way to decline the path to the configuration
file based on $XDG_CONFIG_HOME.

Allow the caller to pass xdg=NULL to signal that it is not
interested in the XDG location.

Commit-message-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Matthieu Moy authored and Junio C Hamano committed Jul 25, 2014
1 parent 9830534 commit 06b2d87
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions path.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ void home_config_paths(char **global, char **xdg, char *file)
*global = mkpathdup("%s/.gitconfig", home);
}

if (!xdg_home)
*xdg = NULL;
else
*xdg = mkpathdup("%s/git/%s", xdg_home, file);
if (xdg) {
if (!xdg_home)
*xdg = NULL;
else
*xdg = mkpathdup("%s/git/%s", xdg_home, file);
}

free(to_free);
}
Expand Down

0 comments on commit 06b2d87

Please sign in to comment.