about summary refs log tree commit diff
path: root/src/store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/store.cc')
-rw-r--r--src/store.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/store.cc b/src/store.cc
index 435ac5cc69ce..12de50ec6424 100644
--- a/src/store.cc
+++ b/src/store.cc
@@ -224,24 +224,23 @@ string expandHash(const Hash & hash, const string & target,
 }
 
     
-void addToStore(string srcPath, string & dstPath, Hash & hash)
+void addToStore(string srcPath, string & dstPath, Hash & hash,
+    bool deterministicName)
 {
     srcPath = absPath(srcPath);
-
     hash = hashPath(srcPath);
 
+    string baseName = baseNameOf(srcPath);
+    dstPath = canonPath(nixStore + "/" + (string) hash + "-" + baseName);
+
     try {
         /* !!! should not use the substitutes! */
-        dstPath = expandHash(hash, "", nixStore);
+        dstPath = expandHash(hash, deterministicName ? dstPath : "", nixStore);
         return;
     } catch (...) {
     }
     
-    string baseName = baseNameOf(srcPath);
-    dstPath = canonPath(nixStore + "/" + (string) hash + "-" + baseName);
-
     copyPath(srcPath, dstPath);
-
     registerPath(dstPath, hash);
 }