about summary refs log tree commit diff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-12-01T20·51+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-12-01T20·51+0000
commita824d58b566752b2a89a718fd628053754968d72 (patch)
treeff624d24dbbc61e199d699aa32e7bcf54773de39 /src/libstore/local-store.cc
parentceb982a1be381d59532d0405451f38d263abb617 (diff)
* Merge addToStore and addToStoreFixed.
* addToStore now adds unconditionally, it doesn't use readOnlyMode.
  Read-only operation is up to the caller (who can call
  computeStorePathForPath).

Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index ed948cf4e5..2f2a1b4366 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -619,20 +619,20 @@ static void invalidatePath(Transaction & txn, const Path & path)
 }
 
 
-Path LocalStore::_addToStore(bool fixed, bool recursive,
-    string hashAlgo, const Path & _srcPath)
+Path LocalStore::addToStore(const Path & _srcPath, bool fixed,
+    bool recursive, string hashAlgo)
 {
     Path srcPath(absPath(_srcPath));
     debug(format("adding `%1%' to the store") % srcPath);
 
     std::pair<Path, Hash> pr =
-        computeStorePathForPath(fixed, recursive, hashAlgo, srcPath);
+        computeStorePathForPath(srcPath, fixed, recursive, hashAlgo);
     Path & dstPath(pr.first);
     Hash & h(pr.second);
 
-    if (!readOnlyMode) addTempRoot(dstPath);
+    addTempRoot(dstPath);
 
-    if (!readOnlyMode && !isValidPath(dstPath)) {
+    if (!isValidPath(dstPath)) {
 
         /* The first check above is an optimisation to prevent
            unnecessary lock acquisition. */
@@ -664,26 +664,14 @@ Path LocalStore::_addToStore(bool fixed, bool recursive,
 }
 
 
-Path LocalStore::addToStore(const Path & srcPath)
-{
-    return _addToStore(false, false, "", srcPath);
-}
-
-
-Path LocalStore::addToStoreFixed(bool recursive, string hashAlgo, const Path & srcPath)
-{
-    return _addToStore(true, recursive, hashAlgo, srcPath);
-}
-
-
 Path LocalStore::addTextToStore(const string & suffix, const string & s,
     const PathSet & references)
 {
     Path dstPath = computeStorePathForText(suffix, s);
     
-    if (!readOnlyMode) addTempRoot(dstPath);
+    addTempRoot(dstPath);
 
-    if (!readOnlyMode && !isValidPath(dstPath)) {
+    if (!isValidPath(dstPath)) {
 
         PathLocks outputLock(singleton<PathSet, Path>(dstPath));