diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-06-09 13:45:07 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-06-09 13:45:07 +0200 |
commit | 6cfc2db49424c63b7ca6b837e8a4cb7bf373c01b (patch) | |
tree | 2647bd218f433d64a4fef4649310a1eb52e6bffa /src/libfetchers | |
parent | 1205b41849eadb434a2f38301ce6cfe522a39a14 (diff) |
Fix applyOverride() for github
Diffstat (limited to 'src/libfetchers')
-rw-r--r-- | src/libfetchers/fetchers.cc | 1 | ||||
-rw-r--r-- | src/libfetchers/github.cc | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/libfetchers/fetchers.cc b/src/libfetchers/fetchers.cc index 067db5e2e..d808aadd6 100644 --- a/src/libfetchers/fetchers.cc +++ b/src/libfetchers/fetchers.cc @@ -91,6 +91,7 @@ bool Input::operator ==(const Input & other) const bool Input::contains(const Input & other) const { + if (*this == other) return true; auto other2(other); other2.attrs.erase("ref"); other2.attrs.erase("rev"); diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc index e704592f7..8dc9cb4bf 100644 --- a/src/libfetchers/github.cc +++ b/src/libfetchers/github.cc @@ -59,7 +59,7 @@ struct GitArchiveInputScheme : InputScheme } if (ref && rev) - throw BadURL("URL '%s' contains both a commit hash and a branch/tag name", url.url); + throw BadURL("URL '%s' contains both a commit hash and a branch/tag name %s %s", url.url, *ref, rev->gitRev()); Input input; input.attrs.insert_or_assign("type", type()); @@ -115,14 +115,16 @@ struct GitArchiveInputScheme : InputScheme std::optional<Hash> rev) override { auto input(_input); + if (rev && ref) + throw BadURL("cannot apply both a commit hash (%s) and a branch/tag name ('%s') to input '%s'", + rev->gitRev(), *ref, input.to_string()); if (rev) { input.attrs.insert_or_assign("rev", rev->gitRev()); input.attrs.erase("ref"); } if (ref) { - if (input.getRev()) - throw BadURL("input '%s' contains both a commit hash and a branch/tag name", input.to_string()); input.attrs.insert_or_assign("ref", *ref); + input.attrs.erase("rev"); } return input; } |