From c757d16c8c180bc8a7d74494a2fc92aee7993631 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <e.dolstra@tudelft.nl>
Date: Mon, 14 Mar 2005 18:54:40 +0000
Subject: [PATCH] * Bug in clearSubstitutes().

---
 src/libstore/store.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libstore/store.cc b/src/libstore/store.cc
index 0ac9473bc..03855408e 100644
--- a/src/libstore/store.cc
+++ b/src/libstore/store.cc
@@ -282,7 +282,8 @@ static PathSet getReferers(const Transaction & txn, const Path & storePath)
 void setReferences(const Transaction & txn, const Path & storePath,
     const PathSet & references)
 {
-    if (!isRealisablePath(txn, storePath))
+    /* For unrealisable paths, we can only clear the references. */
+    if (references.size() > 0 && !isRealisablePath(txn, storePath))
         throw Error(
             format("cannot set references for path `%1%' which is invalid and has no substitutes")
             % storePath);
-- 
GitLab