1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 01:51:47 +02:00

nix-store --gc: Make ‘--max-freed 0’ do the right thing

That is, delete almost nothing (it will still remove unused links from
/nix/store/.links).
This commit is contained in:
Eelco Dolstra 2012-08-01 19:14:30 -04:00
parent 1df702d347
commit 967d066d8e
4 changed files with 6 additions and 7 deletions

View file

@ -550,7 +550,7 @@ bool LocalStore::tryToDelete(GCState & state, const Path & path)
} else
deleteGarbage(state, path);
if (state.options.maxFreed && state.results.bytesFreed + state.bytesInvalidated > state.options.maxFreed) {
if (state.results.bytesFreed + state.bytesInvalidated > state.options.maxFreed) {
printMsg(lvlInfo, format("deleted or invalidated more than %1% bytes; stopping") % state.options.maxFreed);
throw GCLimitReached();
}
@ -675,7 +675,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
throw Error(format("cannot delete path `%1%' since it is still alive") % *i);
}
} else {
} else if (options.maxFreed > 0) {
if (shouldDelete(state.options.action))
printMsg(lvlError, format("deleting garbage..."));