mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 07:22:43 +01:00
libutil: Make HashResult a proper struct
This resolves an existing TODO and makes the code slightly more readable.
This commit is contained in:
parent
241420a788
commit
143bd60136
18 changed files with 56 additions and 50 deletions
|
|
@ -254,7 +254,7 @@ ValidPathInfo Store::addToStoreSlow(
|
|||
|
||||
auto hash = method == ContentAddressMethod::Raw::NixArchive && hashAlgo == HashAlgorithm::SHA256 ? narHash
|
||||
: method == ContentAddressMethod::Raw::Git ? git::dumpHash(hashAlgo, srcPath).hash
|
||||
: caHashSink.finish().first;
|
||||
: caHashSink.finish().hash;
|
||||
|
||||
if (expectedCAHash && expectedCAHash != hash)
|
||||
throw Error("hash mismatch for '%s'", srcPath);
|
||||
|
|
@ -1035,8 +1035,8 @@ decodeValidPathInfo(const Store & store, std::istream & str, std::optional<HashR
|
|||
throw Error("number expected");
|
||||
hashGiven = {narHash, *narSize};
|
||||
}
|
||||
ValidPathInfo info(store.parseStorePath(path), hashGiven->first);
|
||||
info.narSize = hashGiven->second;
|
||||
ValidPathInfo info(store.parseStorePath(path), hashGiven->hash);
|
||||
info.narSize = hashGiven->numBytesDigested;
|
||||
std::string deriver;
|
||||
getline(str, deriver);
|
||||
if (deriver != "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue