1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 15:32:43 +01:00

Add SourceAccessor::getFingerprint()

This returns the fingerprint for a specific subpath. This is intended
for "composite" accessors like MountedSourceAccessor, where different
subdirectories can have different fingerprints.
This commit is contained in:
Eelco Dolstra 2025-09-22 22:52:18 +02:00 committed by John Ericson
parent 55c7ef9d40
commit 28d11c5bcc
5 changed files with 50 additions and 0 deletions

View file

@ -91,6 +91,14 @@ struct MountedSourceAccessorImpl : MountedSourceAccessor
else
return nullptr;
}
std::pair<CanonPath, std::optional<std::string>> getFingerprint(const CanonPath & path) override
{
if (fingerprint)
return {path, fingerprint};
auto [accessor, subpath] = resolve(path);
return accessor->getFingerprint(subpath);
}
};
ref<MountedSourceAccessor> makeMountedSourceAccessor(std::map<CanonPath, ref<SourceAccessor>> mounts)