aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops/flakeref.hh
diff options
context:
space:
mode:
authorNick Van den Broeck <nick.van.den.broeck666@gmail.com>2019-04-06 20:45:35 +0200
committerNick Van den Broeck <nick.van.den.broeck666@gmail.com>2019-04-09 09:51:42 +0200
commitf39670c6318ba8d2260b3ac54f46161d74649266 (patch)
tree8c09721deddb9785ea57c508f113a487d730ba35 /src/libexpr/primops/flakeref.hh
parent3ec0c82fab94533807c5c3bb25df2b43d8339ed3 (diff)
Took ref and rev out of FlakeRef
Diffstat (limited to 'src/libexpr/primops/flakeref.hh')
-rw-r--r--src/libexpr/primops/flakeref.hh28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/libexpr/primops/flakeref.hh b/src/libexpr/primops/flakeref.hh
index 94a75fb2b..9276fc737 100644
--- a/src/libexpr/primops/flakeref.hh
+++ b/src/libexpr/primops/flakeref.hh
@@ -101,25 +101,23 @@ typedef std::string FlakeId;
struct FlakeRef
{
+ std::optional<std::string> ref;
+ std::optional<Hash> rev;
+
struct IsFlakeId
{
FlakeId id;
- std::optional<std::string> ref;
- std::optional<Hash> rev;
};
struct IsGitHub
{
std::string owner, repo;
- std::optional<std::string> ref;
- std::optional<Hash> rev;
};
+ // Git, Tarball
struct IsGit
{
std::string uri;
- std::optional<std::string> ref;
- std::optional<Hash> rev;
};
struct IsPath
@@ -161,22 +159,8 @@ struct FlakeRef
FlakeRef baseRef() const;
- void setRef(std::optional<std::string> ref) {
- if (auto refData = std::get_if<IsGit>(&data))
- refData->ref = ref;
- else if (auto refData = std::get_if<IsGitHub>(&data))
- refData->ref = ref;
- else if (auto refData = std::get_if<IsFlakeId>(&data))
- refData->ref = ref;
- }
+ void setRef(std::optional<std::string> ref) { ref = ref; }
- void setRev(std::optional<Hash> rev) {
- if (auto refData = std::get_if<IsGit>(&data))
- refData->rev = rev;
- else if (auto refData = std::get_if<IsGitHub>(&data))
- refData->rev = rev;
- else if (auto refData = std::get_if<IsFlakeId>(&data))
- refData->rev = rev;
- }
+ void setRev(std::optional<Hash> rev) { rev = rev; }
};
}