summaryrefslogtreecommitdiff
path: root/src/attrcache.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-07-22 15:29:46 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-07-22 16:22:28 -0400
commit0bd547a8bee02bf984ea5c7acdc8172044fcb3a4 (patch)
tree4dc86b3fbc275413fccd28405016bbae472adf05 /src/attrcache.c
parent093d579f7be5636c52290a517eee1eebb7471e31 (diff)
downloadlibgit2-0bd547a8bee02bf984ea5c7acdc8172044fcb3a4.tar.gz
attr: introduce GIT_ATTR_CHECK_INCLUDE_COMMIT
Introduce `GIT_ATTR_CHECK_INCLUDE_COMMIT`, which like 4fd5748 allows attribute information to be read from files in the repository. 4fd5748 always reads the information from HEAD, while `GIT_ATTR_CHECK_INCLUDE_COMMIT` allows users to provide the commit to read the attributes from.
Diffstat (limited to 'src/attrcache.c')
-rw-r--r--src/attrcache.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/attrcache.c b/src/attrcache.c
index f07712735..7fe2bfbdb 100644
--- a/src/attrcache.c
+++ b/src/attrcache.c
@@ -224,16 +224,17 @@ int git_attr_cache__get(
return error;
/* load file if we don't have one or if existing one is out of date */
- if (!file || (error = git_attr_file__out_of_date(repo, attr_session, file)) > 0)
+ if (!file ||
+ (error = git_attr_file__out_of_date(repo, attr_session, file, source)) > 0)
error = git_attr_file__load(&updated, repo, attr_session,
entry, source, parser,
allow_macros);
/* if we loaded the file, insert into and/or update cache */
if (updated) {
- if ((error = attr_cache_upsert(cache, updated)) < 0)
+ if ((error = attr_cache_upsert(cache, updated)) < 0) {
git_attr_file__free(updated);
- else {
+ } else {
git_attr_file__free(file); /* offset incref from lookup */
file = updated;
}