forked from lix-project/lix
Use named field initialization for references
This commit is contained in:
parent
8623143921
commit
6a168254ce
|
@ -299,7 +299,7 @@ SV * makeFixedOutputPath(int recursive, char * algo, char * hash, char * name)
|
|||
.method = method,
|
||||
.hash = h,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
});
|
||||
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(path).c_str(), 0)));
|
||||
} catch (Error & e) {
|
||||
|
|
|
@ -1249,7 +1249,7 @@ static void prim_derivationStrict(EvalState & state, const PosIdx pos, Value * *
|
|||
.method = method,
|
||||
.hash = h,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
});
|
||||
drv.env["out"] = state.store->printStorePath(outPath);
|
||||
drv.outputs.insert_or_assign("out",
|
||||
|
|
|
@ -235,7 +235,7 @@ static void fetch(EvalState & state, const PosIdx pos, Value * * args, Value & v
|
|||
.method = unpack ? FileIngestionMethod::Recursive : FileIngestionMethod::Flat,
|
||||
.hash = *expectedHash,
|
||||
},
|
||||
{}
|
||||
.references = {}
|
||||
});
|
||||
|
||||
if (state.store->isValidPath(expectedPath)) {
|
||||
|
|
|
@ -215,7 +215,7 @@ StorePath Input::computeStorePath(Store & store) const
|
|||
.method = FileIngestionMethod::Recursive,
|
||||
.hash = *narHash,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ DownloadFileResult downloadFile(
|
|||
.method = FileIngestionMethod::Flat,
|
||||
.hash = hash,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
},
|
||||
},
|
||||
hashString(htSHA256, sink.s),
|
||||
|
|
|
@ -313,7 +313,7 @@ StorePath BinaryCacheStore::addToStoreFromDump(Source & dump, std::string_view n
|
|||
.method = method,
|
||||
.hash = nar.first,
|
||||
},
|
||||
{
|
||||
.references = {
|
||||
.references = references,
|
||||
.hasSelfReference = false,
|
||||
},
|
||||
|
@ -433,7 +433,7 @@ StorePath BinaryCacheStore::addToStore(
|
|||
.method = method,
|
||||
.hash = h,
|
||||
},
|
||||
{
|
||||
.references = {
|
||||
.references = references,
|
||||
.hasSelfReference = false,
|
||||
},
|
||||
|
|
|
@ -2482,7 +2482,7 @@ DrvOutputs LocalDerivationGoal::registerOutputs()
|
|||
.method = outputHash.method,
|
||||
.hash = got,
|
||||
},
|
||||
rewriteRefs(),
|
||||
.references = rewriteRefs(),
|
||||
},
|
||||
},
|
||||
Hash::dummy,
|
||||
|
|
|
@ -154,10 +154,16 @@ Hash getContentAddressHash(const ContentAddress & ca)
|
|||
ContentAddressWithReferences caWithoutRefs(const ContentAddress & ca) {
|
||||
return std::visit(overloaded {
|
||||
[&](const TextHash & h) -> ContentAddressWithReferences {
|
||||
return TextInfo { h, {}};
|
||||
return TextInfo {
|
||||
h,
|
||||
.references = {},
|
||||
};
|
||||
},
|
||||
[&](const FixedOutputHash & h) -> ContentAddressWithReferences {
|
||||
return FixedOutputInfo { h, {}};
|
||||
return FixedOutputInfo {
|
||||
h,
|
||||
.references = {},
|
||||
};
|
||||
},
|
||||
}, ca);
|
||||
}
|
||||
|
|
|
@ -1426,7 +1426,7 @@ StorePath LocalStore::addToStoreFromDump(Source & source0, std::string_view name
|
|||
.method = method,
|
||||
.hash = hash,
|
||||
},
|
||||
{
|
||||
.references = {
|
||||
.references = references,
|
||||
.hasSelfReference = false,
|
||||
},
|
||||
|
|
|
@ -55,7 +55,7 @@ std::map<StorePath, StorePath> makeContentAddressed(
|
|||
.method = FileIngestionMethod::Recursive,
|
||||
.hash = narModuloHash,
|
||||
},
|
||||
std::move(refs),
|
||||
.references = std::move(refs),
|
||||
},
|
||||
},
|
||||
Hash::dummy,
|
||||
|
|
|
@ -232,7 +232,7 @@ std::pair<StorePath, Hash> Store::computeStorePathForPath(std::string_view name,
|
|||
.method = method,
|
||||
.hash = h,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
};
|
||||
return std::make_pair(makeFixedOutputPath(name, caInfo), h);
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ ValidPathInfo Store::addToStoreSlow(std::string_view name, const Path & srcPath,
|
|||
.method = method,
|
||||
.hash = hash,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
},
|
||||
},
|
||||
narHash,
|
||||
|
@ -1270,16 +1270,18 @@ std::optional<StorePathDescriptor> ValidPathInfo::fullStorePathDescriptorOpt() c
|
|||
return StorePathDescriptor {
|
||||
.name = std::string { path.name() },
|
||||
.info = std::visit(overloaded {
|
||||
[&](const TextHash & th) {
|
||||
TextInfo info { th };
|
||||
[&](const TextHash & th) -> ContentAddressWithReferences {
|
||||
assert(!hasSelfReference);
|
||||
info.references = references;
|
||||
return ContentAddressWithReferences { info };
|
||||
return TextInfo {
|
||||
th,
|
||||
.references = references,
|
||||
};
|
||||
},
|
||||
[&](const FixedOutputHash & foh) {
|
||||
FixedOutputInfo info { foh };
|
||||
info.references = static_cast<PathReferences<StorePath>>(*this);
|
||||
return ContentAddressWithReferences { info };
|
||||
[&](const FixedOutputHash & foh) -> ContentAddressWithReferences {
|
||||
return FixedOutputInfo {
|
||||
foh,
|
||||
.references = static_cast<PathReferences<StorePath>>(*this),
|
||||
};
|
||||
},
|
||||
}, *ca),
|
||||
};
|
||||
|
|
|
@ -220,7 +220,7 @@ static void opPrintFixedPath(Strings opFlags, Strings opArgs)
|
|||
.method = method,
|
||||
.hash = Hash::parseAny(hash, hashAlgo),
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
})));
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ struct CmdAddToStore : MixDryRun, StoreCommand
|
|||
.method = std::move(ingestionMethod),
|
||||
.hash = std::move(hash),
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
},
|
||||
},
|
||||
narHash,
|
||||
|
|
|
@ -72,7 +72,7 @@ std::tuple<StorePath, Hash> prefetchFile(
|
|||
.method = ingestionMethod,
|
||||
.hash = *expectedHash,
|
||||
},
|
||||
{},
|
||||
.references = {},
|
||||
});
|
||||
if (store->isValidPath(*storePath))
|
||||
hash = expectedHash;
|
||||
|
|
|
@ -205,7 +205,7 @@ struct ProfileManifest
|
|||
.method = FileIngestionMethod::Recursive,
|
||||
.hash = narHash,
|
||||
},
|
||||
{ references },
|
||||
.references = { references },
|
||||
},
|
||||
},
|
||||
narHash,
|
||||
|
|
Loading…
Reference in a new issue