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 | |
parent | 1205b41849eadb434a2f38301ce6cfe522a39a14 (diff) |
Fix applyOverride() for github
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/flake/flake.cc | 2 | ||||
-rw-r--r-- | src/libfetchers/fetchers.cc | 1 | ||||
-rw-r--r-- | src/libfetchers/github.cc | 8 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index c94924371..5f021192b 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -57,7 +57,7 @@ static std::tuple<fetchers::Tree, FlakeRef, FlakeRef> fetchOrSubstituteTree( } flakeCache.push_back({originalRef, fetched.value()}); } - + auto [tree, lockedRef] = fetched.value(); debug("got tree '%s' from '%s'", 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; } |