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.
This commit is contained in:
Eelco Dolstra 2017-03-16 12:05:51 +01:00
parent ea7fa88131
commit 91d67692cf
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -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;
},