summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2023-01-23 13:00:01 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2023-02-09 12:10:40 +0000
commit2d08ead9c34317b6727d13d3a4a2a46d429557cb (patch)
tree559dd126c41702baa5e114821ab885891ad0a273
parent523d8b64ba06cfd89fc0b4be2949cd4ed43e4cc7 (diff)
downloadlibgit2-2d08ead9c34317b6727d13d3a4a2a46d429557cb.tar.gz
attr: use home directory for `~` includes
Users can specify an attribute file to be included in the home directory using `~/filename` syntax. Instead of looking in the global configuration location (which may be overridden), use the user's _actual_ home directory. This allows callers to change the global configuration location separately from the home directory.
-rw-r--r--src/libgit2/attrcache.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libgit2/attrcache.c b/src/libgit2/attrcache.c
index b16d95c3c..405944ed1 100644
--- a/src/libgit2/attrcache.c
+++ b/src/libgit2/attrcache.c
@@ -300,7 +300,7 @@ static int attr_cache__lookup_path(
/* expand leading ~/ as needed */
if (cfgval && cfgval[0] == '~' && cfgval[1] == '/') {
- if (! (error = git_sysdir_expand_global_file(&buf, &cfgval[2])))
+ if (! (error = git_sysdir_expand_homedir_file(&buf, &cfgval[2])))
*out = git_str_detach(&buf);
} else if (cfgval) {
*out = git__strdup(cfgval);