mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 08:16:14 +02:00
Fix applyOverride() for github
This commit is contained in:
parent
1205b41849
commit
6cfc2db494
3 changed files with 7 additions and 4 deletions
|
@ -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'",
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue