forked from lix-project/lix
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;
|
||||
input.attrs.insert_or_assign("narHash", narHash.to_string(SRI));
|
||||
|
||||
if (auto narHash2 = getNarHash()) {
|
||||
if (narHash != *narHash2)
|
||||
if (auto prevNarHash = getNarHash()) {
|
||||
if (narHash != *prevNarHash)
|
||||
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;
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ struct GitArchiveInputScheme : InputScheme
|
|||
throw BadURL("URL '%s' contains multiple branch/tag names", url.url);
|
||||
ref = value;
|
||||
}
|
||||
// FIXME: barf on unsupported attributes
|
||||
}
|
||||
|
||||
if (ref && rev)
|
||||
|
|
Loading…
Reference in a new issue