summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-09-20 22:20:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-09-20 22:20:40 (GMT)
commited8794ef7ae9f345ab88c6f1ee728e06fc7b8ce4 (patch)
tree6af09cfc93255ad7c48f2dedc06075e4fc2002b8 /path.c
parent76f5fdc2032d639c9a61ce7f49533a53884f05f6 (diff)
parentb681b191f923267aab80ae7f7ab2f85a692e8833 (diff)
downloadgit-ed8794ef7ae9f345ab88c6f1ee728e06fc7b8ce4.zip
git-ed8794ef7ae9f345ab88c6f1ee728e06fc7b8ce4.tar.gz
git-ed8794ef7ae9f345ab88c6f1ee728e06fc7b8ce4.tar.bz2
Merge branch 'lh/systemd-timers'
"git maintenance" scheduler learned to use systemd timers as a possible backend. * lh/systemd-timers: maintenance: add support for systemd timers on Linux maintenance: `git maintenance run` learned `--scheduler=<scheduler>` cache.h: Introduce a generic "xdg_config_home_for(…)" function
Diffstat (limited to 'path.c')
-rw-r--r--path.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/path.c b/path.c
index 0bc788e..2c89547 100644
--- a/path.c
+++ b/path.c
@@ -1510,21 +1510,28 @@ int looks_like_command_line_option(const char *str)
return str && str[0] == '-';
}
-char *xdg_config_home(const char *filename)
+char *xdg_config_home_for(const char *subdir, const char *filename)
{
const char *home, *config_home;
+ assert(subdir);
assert(filename);
config_home = getenv("XDG_CONFIG_HOME");
if (config_home && *config_home)
- return mkpathdup("%s/git/%s", config_home, filename);
+ return mkpathdup("%s/%s/%s", config_home, subdir, filename);
home = getenv("HOME");
if (home)
- return mkpathdup("%s/.config/git/%s", home, filename);
+ return mkpathdup("%s/.config/%s/%s", home, subdir, filename);
+
return NULL;
}
+char *xdg_config_home(const char *filename)
+{
+ return xdg_config_home_for("git", filename);
+}
+
char *xdg_cache_home(const char *filename)
{
const char *home, *cache_home;