1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

Merge remote-tracking branch 'obsidian/no-hash-type-unknown' into validPathInfo-ca-proper-datatype

This commit is contained in:
John Ericson 2020-06-02 23:30:38 +00:00
commit 3c78ac348c
16 changed files with 89 additions and 64 deletions

View file

@ -3,7 +3,7 @@
namespace nix {
std::string FileSystemHash::printMethodAlgo() const {
return makeFileIngestionPrefix(method) + printHashType(hash.type);
return makeFileIngestionPrefix(method) + printHashType(*hash.type);
}
std::string makeFileIngestionPrefix(const FileIngestionMethod m) {
@ -46,7 +46,7 @@ ContentAddress parseContentAddress(std::string_view rawCa) {
if (prefix == "text") {
auto hashTypeAndHash = rawCa.substr(prefixSeparator+1, string::npos);
Hash hash = Hash(string(hashTypeAndHash));
if (hash.type != HashType::SHA256) {
if (*hash.type != HashType::SHA256) {
throw Error("parseContentAddress: the text hash should have type SHA256");
}
return TextHash { hash };