summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-24 13:07:34 -0700
committerJunio C Hamano <gitster@pobox.com>2017-03-24 13:07:34 -0700
commit78cf8efec34c419ecea86bc8d1fe47ec0b51ba37 (patch)
treee93e9c07cd61311d63aa589cfd2452662dfcafb5 /path.c
parentf364f02724d6ce4c64fae85a86e0452b5634ddf8 (diff)
parent612c49e94d5c761bd9fc4752283b82786c23856a (diff)
downloadgit-78cf8efec34c419ecea86bc8d1fe47ec0b51ba37.tar.gz
Merge branch 'dl/credential-cache-socket-in-xdg-cache'
The default location "~/.git-credential-cache/socket" for the socket used to communicate with the credential-cache daemon has been moved to "~/.cache/git/credential/socket". * dl/credential-cache-socket-in-xdg-cache: credential-cache: add tests for XDG functionality credential-cache: use XDG_CACHE_HOME for socket path.c: add xdg_cache_home
Diffstat (limited to 'path.c')
-rw-r--r--path.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/path.c b/path.c
index efcedafba6..22248436bf 100644
--- a/path.c
+++ b/path.c
@@ -1272,6 +1272,21 @@ char *xdg_config_home(const char *filename)
return NULL;
}
+char *xdg_cache_home(const char *filename)
+{
+ const char *home, *cache_home;
+
+ assert(filename);
+ cache_home = getenv("XDG_CACHE_HOME");
+ if (cache_home && *cache_home)
+ return mkpathdup("%s/git/%s", cache_home, filename);
+
+ home = getenv("HOME");
+ if (home)
+ return mkpathdup("%s/.cache/git/%s", home, filename);
+ return NULL;
+}
+
GIT_PATH_FUNC(git_path_cherry_pick_head, "CHERRY_PICK_HEAD")
GIT_PATH_FUNC(git_path_revert_head, "REVERT_HEAD")
GIT_PATH_FUNC(git_path_squash_msg, "SQUASH_MSG")