From f96d2dea266760e5587356e72d1cadaace5f7d5b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 23 Dec 2005 21:36:44 +0000 Subject: * Added a flag `--ignore-liveness' to `nix-store --delete'. It deletes a path even if it is reachable from a root. However, it won't delete a path that still has referrers (since that would violate store invariants). Don't try this at home. It's a useful hack for recovering from certain situations in a somewhat clean way (e.g., holes in closures due to disk corruption). --- src/libstore/gc.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/libstore/gc.cc') diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index c02f59f2cca6..5f4f5b27ff79 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -304,7 +304,7 @@ static Paths topoSort(const PathSet & paths) void collectGarbage(GCAction action, const PathSet & pathsToDelete, - PathSet & result, unsigned long long & bytesFreed) + bool ignoreLiveness, PathSet & result, unsigned long long & bytesFreed) { result.clear(); bytesFreed = 0; @@ -323,7 +323,8 @@ void collectGarbage(GCAction action, const PathSet & pathsToDelete, permanent roots cannot increase now. */ Path rootsDir = canonPath((format("%1%/%2%") % nixStateDir % gcRootsDir).str()); PathSet roots; - findRoots(rootsDir, true, roots); + if (!ignoreLiveness) + findRoots(rootsDir, true, roots); if (action == gcReturnRoots) { result = roots; -- cgit 1.4.1