Apply suggestions from code review
Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
This commit is contained in:
parent
a5d820a0a3
commit
25e61812f3
5 changed files with 7 additions and 15 deletions
|
@ -114,11 +114,7 @@ struct LegacySSHStore : public Store
|
||||||
if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 4) {
|
if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 4) {
|
||||||
auto s = readString(conn->from);
|
auto s = readString(conn->from);
|
||||||
info->narHash = s.empty() ? Hash() : Hash(s);
|
info->narHash = s.empty() ? Hash() : Hash(s);
|
||||||
{
|
info->ca = parseContentAddressOpt(readString(conn->from));
|
||||||
std::string rawCaOpt;
|
|
||||||
conn->from >> rawCaOpt;
|
|
||||||
info->ca = parseContentAddressOpt(rawCaOpt);
|
|
||||||
}
|
|
||||||
info->sigs = readStrings<StringSet>(conn->from);
|
info->sigs = readStrings<StringSet>(conn->from);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -999,7 +999,9 @@ void LocalStore::addToStore(const ValidPathInfo & info, Source & source,
|
||||||
|
|
||||||
deletePath(realPath);
|
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");
|
settings.requireExperimentalFeature("ca-references");
|
||||||
|
|
||||||
/* While restoring the path from the NAR, compute the hash
|
/* While restoring the path from the NAR, compute the hash
|
||||||
|
|
|
@ -381,9 +381,7 @@ void RemoteStore::queryPathInfoUncached(const StorePath & path,
|
||||||
if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 16) {
|
if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 16) {
|
||||||
conn->from >> info->ultimate;
|
conn->from >> info->ultimate;
|
||||||
info->sigs = readStrings<StringSet>(conn->from);
|
info->sigs = readStrings<StringSet>(conn->from);
|
||||||
string caOptRaw;
|
info->ca = parseContentAddressOpt(readString(conn->from));
|
||||||
conn->from >> caOptRaw;
|
|
||||||
info->ca = parseContentAddressOpt(caOptRaw);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
callback(std::move(info));
|
callback(std::move(info));
|
||||||
|
|
|
@ -944,11 +944,7 @@ static void opServe(Strings opFlags, Strings opArgs)
|
||||||
info.references = readStorePaths<StorePathSet>(*store, in);
|
info.references = readStorePaths<StorePathSet>(*store, in);
|
||||||
in >> info.registrationTime >> info.narSize >> info.ultimate;
|
in >> info.registrationTime >> info.narSize >> info.ultimate;
|
||||||
info.sigs = readStrings<StringSet>(in);
|
info.sigs = readStrings<StringSet>(in);
|
||||||
{
|
info.ca = parseContentAddressOpt(readString(in));
|
||||||
std::string rawCA;
|
|
||||||
in >> rawCA;
|
|
||||||
info.ca = parseContentAddressOpt(rawCA);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.narSize == 0)
|
if (info.narSize == 0)
|
||||||
throw Error("narInfo is too old and missing the narSize field");
|
throw Error("narInfo is too old and missing the narSize field");
|
||||||
|
|
|
@ -87,7 +87,7 @@ struct CmdVerify : StorePathsCommand
|
||||||
if (!noContents) {
|
if (!noContents) {
|
||||||
|
|
||||||
std::unique_ptr<AbstractHashSink> hashSink;
|
std::unique_ptr<AbstractHashSink> hashSink;
|
||||||
if (info->ca)
|
if (!info->ca)
|
||||||
hashSink = std::make_unique<HashSink>(info->narHash.type);
|
hashSink = std::make_unique<HashSink>(info->narHash.type);
|
||||||
else
|
else
|
||||||
hashSink = std::make_unique<HashModuloSink>(info->narHash.type, storePathToHash(store->printStorePath(info->path)));
|
hashSink = std::make_unique<HashModuloSink>(info->narHash.type, storePathToHash(store->printStorePath(info->path)));
|
||||||
|
|
Loading…
Reference in a new issue