diff options
author | Nick Van den Broeck <nick.van.den.broeck666@gmail.com> | 2019-03-10 07:05:05 +0100 |
---|---|---|
committer | Nick Van den Broeck <nick.van.den.broeck666@gmail.com> | 2019-03-22 15:22:18 +0100 |
commit | 5e4d92d267c080bcb81168e37429bbb56bc39fb2 (patch) | |
tree | b784a1643d392a88d7f98f964e55827e19751584 /src/libexpr/primops/flakeref.cc | |
parent | e007f367bd605ad14ddf84d1d5ad611aa427d338 (diff) |
Issue #15 is finished
Diffstat (limited to 'src/libexpr/primops/flakeref.cc')
-rw-r--r-- | src/libexpr/primops/flakeref.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libexpr/primops/flakeref.cc b/src/libexpr/primops/flakeref.cc index a2700f102..8e7c1f8df 100644 --- a/src/libexpr/primops/flakeref.cc +++ b/src/libexpr/primops/flakeref.cc @@ -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; +} } |