about summary refs log tree commit diff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-03-16T11·05+0100
committerEelco Dolstra <edolstra@gmail.com>2017-03-16T11·05+0100
commit91d67692cfb05e4ece744fb9d144921ae920f2de (patch)
treeaca2fa194fe0bc652ed9b6e87220dd528f97dde5 /src/libstore/store-api.cc
parentea7fa88131eb486ffe54f32601d36a64374f7b7c (diff)
copyPaths(): Don't query path info for a path the target already has
For example, this cuts "nix-copy-closure --from" on a NixOS system
closure from 15.9s to 0.5s.
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 9c755965e4..9ab3f36329 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -822,6 +822,7 @@ void copyPaths(ref<Store> from, ref<Store> to, const Paths & storePaths, bool su
         PathSet(storePaths.begin(), storePaths.end()),
 
         [&](const Path & storePath) {
+            if (to->isValidPath(storePath)) return PathSet();
             return from->queryPathInfo(storePath)->references;
         },