fetchTree/git: Cache export-ignore filter

This commit is contained in:
Robert Hensing 2024-01-12 17:18:56 +01:00
parent d80c582b78
commit 274d887fee
1 changed files with 3 additions and 3 deletions

View File

@ -660,12 +660,12 @@ struct GitInputAccessor : InputAccessor
} }
}; };
struct GitExportIgnoreInputAccessor : FilteringInputAccessor { struct GitExportIgnoreInputAccessor : CachingFilteringInputAccessor {
ref<GitRepoImpl> repo; ref<GitRepoImpl> repo;
std::optional<Hash> rev; std::optional<Hash> rev;
GitExportIgnoreInputAccessor(ref<GitRepoImpl> repo, ref<InputAccessor> next, std::optional<Hash> rev) GitExportIgnoreInputAccessor(ref<GitRepoImpl> repo, ref<InputAccessor> next, std::optional<Hash> rev)
: FilteringInputAccessor(next, [&](const CanonPath & path) { : CachingFilteringInputAccessor(next, [&](const CanonPath & path) {
return RestrictedPathError(fmt("'%s' does not exist because it was fetched with exportIgnore enabled", path)); return RestrictedPathError(fmt("'%s' does not exist because it was fetched with exportIgnore enabled", path));
}) })
, repo(repo) , repo(repo)
@ -722,7 +722,7 @@ struct GitExportIgnoreInputAccessor : FilteringInputAccessor {
} }
} }
bool isAllowed(const CanonPath & path) override bool isAllowedUncached(const CanonPath & path) override
{ {
return !isExportIgnored(path); return !isExportIgnored(path);
} }