diff options
-rw-r--r-- | src/libfetchers/fetchers.cc | 18 | ||||
-rw-r--r-- | src/libfetchers/github.cc | 1 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/libfetchers/fetchers.cc b/src/libfetchers/fetchers.cc index e4852d662..aac8aa8c5 100644 --- a/src/libfetchers/fetchers.cc +++ b/src/libfetchers/fetchers.cc @@ -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; diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc index 8d113967e..d20b5d00c 100644 --- a/src/libfetchers/github.cc +++ b/src/libfetchers/github.cc @@ -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) |