aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-01-29 22:53:03 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-01-29 23:14:23 +0100
commit88b44b1e94735710853bdabb6904073bc77f2ccb (patch)
tree2ccde37edb5fda4d0a2b96e472478419a9fedac1 /src/libstore
parent68e0ca608fa55d209a9d9c3b74a987ab496e0284 (diff)
Fix flake update check
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/fetchers/git.cc5
-rw-r--r--src/libstore/fetchers/mercurial.cc5
-rw-r--r--src/libstore/fetchers/parse.cc10
-rw-r--r--src/libstore/fetchers/parse.hh2
4 files changed, 20 insertions, 2 deletions
diff --git a/src/libstore/fetchers/git.cc b/src/libstore/fetchers/git.cc
index 16bbcd285..1350c5754 100644
--- a/src/libstore/fetchers/git.cc
+++ b/src/libstore/fetchers/git.cc
@@ -83,7 +83,7 @@ struct GitInput : Input
auto other2 = dynamic_cast<const GitInput *>(&other);
return
other2
- && url.url == other2->url.url
+ && url == other2->url
&& rev == other2->rev
&& ref == other2->ref;
}
@@ -361,6 +361,8 @@ struct GitInputScheme : InputScheme
auto input = std::make_unique<GitInput>(url);
+ input->url.query.clear();
+
for (auto &[name, value] : url.query) {
if (name == "rev") {
if (!std::regex_match(value, revRegex))
@@ -372,6 +374,7 @@ struct GitInputScheme : InputScheme
throw BadURL("Git URL '%s' contains an invalid branch/tag name", url.url);
input->ref = value;
}
+ else input->url.query.insert_or_assign(name, value);
}
return input;
diff --git a/src/libstore/fetchers/mercurial.cc b/src/libstore/fetchers/mercurial.cc
index e6f252700..e012f98fc 100644
--- a/src/libstore/fetchers/mercurial.cc
+++ b/src/libstore/fetchers/mercurial.cc
@@ -29,7 +29,7 @@ struct MercurialInput : Input
auto other2 = dynamic_cast<const MercurialInput *>(&other);
return
other2
- && url.url == other2->url.url
+ && url == other2->url
&& rev == other2->rev
&& ref == other2->ref;
}
@@ -255,6 +255,8 @@ struct MercurialInputScheme : InputScheme
auto input = std::make_unique<MercurialInput>(url);
+ input->url.query.clear();
+
for (auto &[name, value] : url.query) {
if (name == "rev") {
if (!std::regex_match(value, revRegex))
@@ -266,6 +268,7 @@ struct MercurialInputScheme : InputScheme
throw BadURL("Mercurial URL '%s' contains an invalid branch/tag name", url.url);
input->ref = value;
}
+ else input->url.query.insert_or_assign(name, value);
}
return input;
diff --git a/src/libstore/fetchers/parse.cc b/src/libstore/fetchers/parse.cc
index 88c2844d0..dc1b3efe6 100644
--- a/src/libstore/fetchers/parse.cc
+++ b/src/libstore/fetchers/parse.cc
@@ -127,4 +127,14 @@ std::string ParsedURL::to_string() const
+ (fragment.empty() ? "" : "#" + percentEncode(fragment));
}
+bool ParsedURL::operator ==(const ParsedURL & other) const
+{
+ return
+ scheme == other.scheme
+ && authority == other.authority
+ && path == other.path
+ && query == other.query
+ && fragment == other.fragment;
+}
+
}
diff --git a/src/libstore/fetchers/parse.hh b/src/libstore/fetchers/parse.hh
index 22cc57816..45d5182b0 100644
--- a/src/libstore/fetchers/parse.hh
+++ b/src/libstore/fetchers/parse.hh
@@ -15,6 +15,8 @@ struct ParsedURL
std::string fragment;
std::string to_string() const;
+
+ bool operator ==(const ParsedURL & other) const;
};
MakeError(BadURL, Error);