about summary refs log tree commit diff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index e038cd4b29..a4ad97331a 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -1671,6 +1671,16 @@ void LocalStore::verifyPath(const Path & path, const PathSet & store,
 }
 
 
+bool LocalStore::pathContentsGood(const Path & path)
+{
+    ValidPathInfo info = queryPathInfo(path);
+    if (!pathExists(path)) return false;
+    HashResult current = hashPath(info.hash.type, path);
+    Hash nullHash(htSHA256);
+    return info.hash == nullHash || info.hash == current.first;
+}
+
+
 /* Functions for upgrading from the pre-SQLite database. */
 
 PathSet LocalStore::queryValidPathsOld()