1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-29 21:50:58 +01:00

Fix addPath()

This commit is contained in:
Eelco Dolstra 2022-05-11 16:29:17 +02:00
parent 8b5f37ea92
commit feac6d8651
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 47 additions and 49 deletions

View file

@ -220,26 +220,17 @@ StorePath Store::makeTextPath(std::string_view name, const Hash & hash,
}
std::pair<StorePath, Hash> Store::computeStorePathForPath(std::string_view name,
const Path & srcPath, FileIngestionMethod method, HashType hashAlgo, PathFilter & filter) const
{
Hash h = method == FileIngestionMethod::Recursive
? hashPath(hashAlgo, srcPath, filter).first
: hashFile(hashAlgo, srcPath);
return std::make_pair(makeFixedOutputPath(method, h, name), h);
}
std::pair<StorePath, Hash> Store::computeStorePathFromDump(
Source & dump,
std::string_view name,
FileIngestionMethod method,
HashType hashAlgo) const
HashType hashAlgo,
const StorePathSet & references) const
{
HashSink sink(hashAlgo);
dump.drainInto(sink);
auto hash = sink.finish().first;
return {makeFixedOutputPath(method, hash, name), hash};
return {makeFixedOutputPath(method, hash, name, references), hash};
}