Skip to content

Commit 06b2d87

Browse files
moygitster
authored andcommitted
home_config_paths(): let the caller ignore xdg path
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 <[email protected]> Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9830534 commit 06b2d87

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

path.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,12 @@ void home_config_paths(char **global, char **xdg, char *file)
148148
*global = mkpathdup("%s/.gitconfig", home);
149149
}
150150

151-
if (!xdg_home)
152-
*xdg = NULL;
153-
else
154-
*xdg = mkpathdup("%s/git/%s", xdg_home, file);
151+
if (xdg) {
152+
if (!xdg_home)
153+
*xdg = NULL;
154+
else
155+
*xdg = mkpathdup("%s/git/%s", xdg_home, file);
156+
}
155157

156158
free(to_free);
157159
}

0 commit comments

Comments
 (0)