mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 17:46:15 +02:00
Check revCount / lastModified input attributes if specified
This commit is contained in:
parent
950b46821f
commit
0e7f77a59a
2 changed files with 15 additions and 4 deletions
|
@ -111,13 +111,23 @@ std::pair<Tree, Input> Input::fetch(ref<Store> store) const
|
||||||
auto narHash = store->queryPathInfo(tree.storePath)->narHash;
|
auto narHash = store->queryPathInfo(tree.storePath)->narHash;
|
||||||
input.attrs.insert_or_assign("narHash", narHash.to_string(SRI));
|
input.attrs.insert_or_assign("narHash", narHash.to_string(SRI));
|
||||||
|
|
||||||
if (auto narHash2 = getNarHash()) {
|
if (auto prevNarHash = getNarHash()) {
|
||||||
if (narHash != *narHash2)
|
if (narHash != *prevNarHash)
|
||||||
throw Error("NAR hash mismatch in input '%s' (%s), expected '%s', got '%s'",
|
throw Error("NAR hash mismatch in input '%s' (%s), expected '%s', got '%s'",
|
||||||
to_string(), tree.actualPath, narHash2->to_string(SRI), narHash.to_string(SRI));
|
to_string(), tree.actualPath, prevNarHash->to_string(SRI), narHash.to_string(SRI));
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: check lastModified, revCount
|
if (auto prevLastModified = getLastModified()) {
|
||||||
|
if (input.getLastModified() != prevLastModified)
|
||||||
|
throw Error("'lastModified' attribute mismatch in input '%s', expected %d",
|
||||||
|
input.to_string(), *prevLastModified);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto prevRevCount = getRevCount()) {
|
||||||
|
if (input.getRevCount() != prevRevCount)
|
||||||
|
throw Error("'revCount' attribute mismatch in input '%s', expected %d",
|
||||||
|
input.to_string(), *prevRevCount);
|
||||||
|
}
|
||||||
|
|
||||||
input.immutable = true;
|
input.immutable = true;
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ struct GitArchiveInputScheme : InputScheme
|
||||||
throw BadURL("URL '%s' contains multiple branch/tag names", url.url);
|
throw BadURL("URL '%s' contains multiple branch/tag names", url.url);
|
||||||
ref = value;
|
ref = value;
|
||||||
}
|
}
|
||||||
|
// FIXME: barf on unsupported attributes
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ref && rev)
|
if (ref && rev)
|
||||||
|
|
Loading…
Reference in a new issue