forked from lix-project/lix
Fix applyOverride() for github
This commit is contained in:
parent
1205b41849
commit
6cfc2db494
|
@ -57,7 +57,7 @@ static std::tuple<fetchers::Tree, FlakeRef, FlakeRef> fetchOrSubstituteTree(
|
||||||
}
|
}
|
||||||
flakeCache.push_back({originalRef, fetched.value()});
|
flakeCache.push_back({originalRef, fetched.value()});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto [tree, lockedRef] = fetched.value();
|
auto [tree, lockedRef] = fetched.value();
|
||||||
|
|
||||||
debug("got tree '%s' from '%s'",
|
debug("got tree '%s' from '%s'",
|
||||||
|
|
|
@ -91,6 +91,7 @@ bool Input::operator ==(const Input & other) const
|
||||||
|
|
||||||
bool Input::contains(const Input & other) const
|
bool Input::contains(const Input & other) const
|
||||||
{
|
{
|
||||||
|
if (*this == other) return true;
|
||||||
auto other2(other);
|
auto other2(other);
|
||||||
other2.attrs.erase("ref");
|
other2.attrs.erase("ref");
|
||||||
other2.attrs.erase("rev");
|
other2.attrs.erase("rev");
|
||||||
|
|
|
@ -59,7 +59,7 @@ struct GitArchiveInputScheme : InputScheme
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ref && rev)
|
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 input;
|
||||||
input.attrs.insert_or_assign("type", type());
|
input.attrs.insert_or_assign("type", type());
|
||||||
|
@ -115,14 +115,16 @@ struct GitArchiveInputScheme : InputScheme
|
||||||
std::optional<Hash> rev) override
|
std::optional<Hash> rev) override
|
||||||
{
|
{
|
||||||
auto input(_input);
|
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) {
|
if (rev) {
|
||||||
input.attrs.insert_or_assign("rev", rev->gitRev());
|
input.attrs.insert_or_assign("rev", rev->gitRev());
|
||||||
input.attrs.erase("ref");
|
input.attrs.erase("ref");
|
||||||
}
|
}
|
||||||
if (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.insert_or_assign("ref", *ref);
|
||||||
|
input.attrs.erase("rev");
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue