aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers/mercurial.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-04-14 14:55:27 +0200
committerGitHub <noreply@github.com>2022-04-14 14:55:27 +0200
commitd6effddd3b9657988d1e86e1258c33de6ae4af2b (patch)
treea330ae3334165b5430b394eafaf7f3d2bebf9dc7 /src/libfetchers/mercurial.cc
parent0e58affd3967d113e43811311db9ee090778a756 (diff)
parent2769e43f61d827e1b8fe46257450986d76319243 (diff)
Merge pull request #6387 from Uthar/fix
assert hash types for Git and Mercurial
Diffstat (limited to 'src/libfetchers/mercurial.cc')
-rw-r--r--src/libfetchers/mercurial.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libfetchers/mercurial.cc b/src/libfetchers/mercurial.cc
index 51cf35bf4..1beb8b944 100644
--- a/src/libfetchers/mercurial.cc
+++ b/src/libfetchers/mercurial.cc
@@ -203,8 +203,17 @@ struct MercurialInputScheme : InputScheme
if (!input.getRef()) input.attrs.insert_or_assign("ref", "default");
+ auto checkHashType = [&](const std::optional<Hash> & hash)
+ {
+ if (hash.has_value() && hash->type != htSHA1)
+ throw Error("Hash '%s' is not supported by Mercurial. Only sha1 is supported.", hash->to_string(Base16, true));
+ };
+
+
auto getLockedAttrs = [&]()
{
+ checkHashType(input.getRev());
+
return Attrs({
{"type", "hg"},
{"name", name},