mirror of
https://github.com/NixOS/nix
synced 2025-06-27 16:51:15 +02:00
Use named field initialization for references
This commit is contained in:
parent
8623143921
commit
6a168254ce
15 changed files with 34 additions and 26 deletions
|
@ -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),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue