about summary refs log tree commit diff
path: root/src/fstate.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/fstate.cc')
-rw-r--r--src/fstate.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/fstate.cc b/src/fstate.cc
index 85f8c75cc5bc..1c8c6776f1ed 100644
--- a/src/fstate.cc
+++ b/src/fstate.cc
@@ -31,9 +31,10 @@ ATerm termFromId(const FSId & id)
 }
 
 
-FSId writeTerm(ATerm t, const string & suffix)
+FSId writeTerm(ATerm t, const string & suffix, FSId id)
 {
-    FSId id = hashTerm(t);
+    /* By default, the id of a term is its hash. */
+    if (id == FSId()) id = hashTerm(t);
 
     string path = canonPath(nixStore + "/" + 
         (string) id + suffix + ".nix");