Merge branch 'avoid-quadratic-gc' of https://github.com/trofi/nix

This commit is contained in:
Eelco Dolstra 2022-03-17 21:35:42 +01:00
commit d8f69b9a4c

View file

@ -678,7 +678,8 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
alive.insert(start);
try {
StorePathSet closure;
computeFSClosure(*path, closure);
computeFSClosure(*path, closure,
/* flipDirection */ false, gcKeepOutputs, gcKeepDerivations);
for (auto & p : closure)
alive.insert(p);
} catch (InvalidPath &) { }