mirror of
https://github.com/NixOS/nix.git
synced 2025-12-01 22:50:59 +01:00
Merge remote-tracking branch 'upstream/master' into path-info
This commit is contained in:
commit
55caef36ed
85 changed files with 1320 additions and 591 deletions
|
|
@ -244,9 +244,18 @@ std::optional<std::string> Input::getRef() const
|
|||
|
||||
std::optional<Hash> Input::getRev() const
|
||||
{
|
||||
if (auto s = maybeGetStrAttr(attrs, "rev"))
|
||||
return Hash::parseAny(*s, htSHA1);
|
||||
return {};
|
||||
std::optional<Hash> hash = {};
|
||||
|
||||
if (auto s = maybeGetStrAttr(attrs, "rev")) {
|
||||
try {
|
||||
hash = Hash::parseAnyPrefixed(*s);
|
||||
} catch (BadHash &e) {
|
||||
// Default to sha1 for backwards compatibility with existing flakes
|
||||
hash = Hash::parseAny(*s, htSHA1);
|
||||
}
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
std::optional<uint64_t> Input::getRevCount() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue