aboutsummaryrefslogtreecommitdiff
path: root/src/nix/verify.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/verify.cc')
-rw-r--r--src/nix/verify.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/nix/verify.cc b/src/nix/verify.cc
index 74d9673b6..4b0f80c62 100644
--- a/src/nix/verify.cc
+++ b/src/nix/verify.cc
@@ -3,6 +3,7 @@
#include "store-api.hh"
#include "sync.hh"
#include "thread-pool.hh"
+#include "references.hh"
#include <atomic>
@@ -88,10 +89,15 @@ struct CmdVerify : StorePathsCommand
if (!noContents) {
- HashSink sink(info->narHash.type);
- store->narFromPath(info->path, sink);
+ std::unique_ptr<AbstractHashSink> hashSink;
+ if (info->ca == "")
+ hashSink = std::make_unique<HashSink>(info->narHash.type);
+ else
+ hashSink = std::make_unique<HashModuloSink>(info->narHash.type, storePathToHash(info->path));
- auto hash = sink.finish();
+ store->narFromPath(info->path, *hashSink);
+
+ auto hash = hashSink->finish();
if (hash.first != info->narHash) {
corrupted++;