summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2014-07-25 19:11:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-07-25 19:23:08 (GMT)
commit06b2d87244d74a6b084a08677dfd66d58b94ebfa (patch)
tree23cc9fb79f5d5252418402269c663d9b9164cc7f /path.c
parent9830534e40bd15231357965441d4fe02a6a4810e (diff)
downloadgit-06b2d87244d74a6b084a08677dfd66d58b94ebfa.zip
git-06b2d87244d74a6b084a08677dfd66d58b94ebfa.tar.gz
git-06b2d87244d74a6b084a08677dfd66d58b94ebfa.tar.bz2
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>
Diffstat (limited to 'path.c')
-rw-r--r--path.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/path.c b/path.c
index c36f003..1b6cdc4 100644
--- a/path.c
+++ b/path.c
@@ -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);
}