about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-24T16·11+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-24T16·11+0100
commit5a64e66268471d2141e5b5c72b9658644c113414 (patch)
tree3fa25f3a8107dc3bb7a0d05409b249c44e8de5c4
parent9ccbd55c5b55b5530e61fd20476d9f20fd45e074 (diff)
LocalStore::addTextToStore(): Don't read the path we just wrote
This eliminates some unnecessary (presumably cached) I/O.
-rw-r--r--src/libstore/local-store.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 308aebd73bb4..1a12c91c732d 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -1444,14 +1444,16 @@ Path LocalStore::addTextToStore(const string & name, const string & s,
 
             canonicalisePathMetaData(dstPath, -1);
 
-            HashResult hash = hashPath(htSHA256, dstPath);
+            StringSink sink;
+            dumpString(s, sink);
+            auto hash = hashString(htSHA256, sink.s);
 
             optimisePath(dstPath);
 
             ValidPathInfo info;
             info.path = dstPath;
-            info.narHash = hash.first;
-            info.narSize = hash.second;
+            info.narHash = hash;
+            info.narSize = sink.s.size();
             info.references = references;
             registerValidPath(info);
         }