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 <gitster@pobox.com> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matthieu Moy committed
Jul 25, 2014 at 21:11 UTC
06b2d87244d74a6b084a08677dfd66d58b94ebfa
1 file changed
+6
-4
path.c
+6
-4
@@ -148,10 +148,12 @@ void home_config_paths(char **global, char **xdg, char *file)
148
*global = mkpathdup("%s/.gitconfig", home);
149
}
150
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
+ }
157
158
free(to_free);
159
}