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

Issue #15 is finished

This commit is contained in:
Nick Van den Broeck 2019-03-10 07:05:05 +01:00
parent e007f367bd
commit 5e4d92d267
6 changed files with 136 additions and 15 deletions

View file

@ -152,4 +152,19 @@ bool FlakeRef::isImmutable() const
else abort();
}
FlakeRef FlakeRef::baseRef() const // Removes the ref and rev from a FlakeRef.
{
FlakeRef result(*this);
if (auto refData = std::get_if<FlakeRef::IsGitHub>(&result.data)) {
refData->ref = std::nullopt;
refData->rev = std::nullopt;
} else if (auto refData = std::get_if<FlakeRef::IsGit>(&result.data)) {
refData->ref = std::nullopt;
refData->rev = std::nullopt;
} else if (auto refData = std::get_if<FlakeRef::IsGit>(&result.data)) {
refData->ref = std::nullopt;
refData->rev = std::nullopt;
}
return result;
}
}