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/github.cc | |
parent | 1205b41849eadb434a2f38301ce6cfe522a39a14 (diff) |
Fix applyOverride() for github
Diffstat (limited to 'src/libfetchers/github.cc')
-rw-r--r-- | src/libfetchers/github.cc | 8 |
1 files changed, 5 insertions, 3 deletions
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; } |