]> git.ipfire.org Git - thirdparty/git.git/commit
cache.h: Introduce a generic "xdg_config_home_for(…)" function
authorLénaïc Huard <lenaic@lhuard.fr>
Sat, 4 Sep 2021 20:54:58 +0000 (22:54 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Sep 2021 17:57:04 +0000 (10:57 -0700)
commitcb7db5bbd56f587a35c1861282c46d424fee0b38
tree74e1279faf234aa87d77f21a8f3a0642783d6b3d
parentebf3c04b262aa27fbb97f8a0156c2347fecafafb
cache.h: Introduce a generic "xdg_config_home_for(…)" function

Current implementation of `xdg_config_home(filename)` returns
`$XDG_CONFIG_HOME/git/$filename`, with the `git` subdirectory inserted
between the `XDG_CONFIG_HOME` environment variable and the parameter.

This patch introduces a `xdg_config_home_for(subdir, filename)` function
which is more generic. It only concatenates "$XDG_CONFIG_HOME", or
"$HOME/.config" if the former isn’t defined, with the parameters,
without adding `git` in between.

`xdg_config_home(filename)` is now implemented by calling
`xdg_config_home_for("git", filename)` but this new generic function can
be used to compute the configuration directory of other programs.

Signed-off-by: Lénaïc Huard <lenaic@lhuard.fr>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
path.c