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

Apply suggestions from code review

Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
This commit is contained in:
John Ericson 2020-06-02 12:47:18 -04:00 committed by GitHub
parent a5d820a0a3
commit 25e61812f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 15 deletions

View file

@ -114,11 +114,7 @@ struct LegacySSHStore : public Store
if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 4) {
auto s = readString(conn->from);
info->narHash = s.empty() ? Hash() : Hash(s);
{
std::string rawCaOpt;
conn->from >> rawCaOpt;
info->ca = parseContentAddressOpt(rawCaOpt);
}
info->ca = parseContentAddressOpt(readString(conn->from));
info->sigs = readStrings<StringSet>(conn->from);
}

View file

@ -999,7 +999,9 @@ void LocalStore::addToStore(const ValidPathInfo & info, Source & source,
deletePath(realPath);
if (info.ca && !info.references.empty() && !std::holds_alternative<TextHash>(*info.ca))
// text hashing has long been allowed to have non-self-references because it is used for drv files.
bool refersToSelf = info.references.count(info.path) > 0;
if (info.ca && !info.references.empty() && !(std::holds_alternative<TextHash>(*info.ca) && !refersToSelf))
settings.requireExperimentalFeature("ca-references");
/* While restoring the path from the NAR, compute the hash

View file

@ -381,9 +381,7 @@ void RemoteStore::queryPathInfoUncached(const StorePath & path,
if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 16) {
conn->from >> info->ultimate;
info->sigs = readStrings<StringSet>(conn->from);
string caOptRaw;
conn->from >> caOptRaw;
info->ca = parseContentAddressOpt(caOptRaw);
info->ca = parseContentAddressOpt(readString(conn->from));
}
}
callback(std::move(info));