Add a generic check for rev attribute mismatches

This commit is contained in:
Eelco Dolstra 2023-06-07 15:06:12 +02:00
parent 041486b116
commit 3402b650cd

View file

@ -159,6 +159,12 @@ std::pair<Tree, Input> Input::fetch(ref<Store> store) const
input.to_string(), *prevLastModified); input.to_string(), *prevLastModified);
} }
if (auto prevRev = getRev()) {
if (input.getRev() != prevRev)
throw Error("'rev' attribute mismatch in input '%s', expected %s",
input.to_string(), prevRev->gitRev());
}
if (auto prevRevCount = getRevCount()) { if (auto prevRevCount = getRevCount()) {
if (input.getRevCount() != prevRevCount) if (input.getRevCount() != prevRevCount)
throw Error("'revCount' attribute mismatch in input '%s', expected %d", throw Error("'revCount' attribute mismatch in input '%s', expected %d",