about summary refs log tree commit diff
path: root/src/libstore/gc.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-03-08T21·31+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-03-08T21·31+0000
commit44f6e6de77dd318800775d594b1f33cffa2be9a5 (patch)
treeffb0c44c0e68b00e9c7f0cf3c4c39dc3ac201c72 /src/libstore/gc.cc
parent2e4ef03aa3247782339f3d5af8547b448d38b8d2 (diff)
* Set `gc-keep-outputs' or `gc-keep-derivations' to false with
  `--delete --ignore-liveness'.

Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r--src/libstore/gc.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index cf073c5d9a..87e0a05bc9 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -563,6 +563,15 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
     
     state.gcKeepOutputs = queryBoolSetting("gc-keep-outputs", false);
     state.gcKeepDerivations = queryBoolSetting("gc-keep-derivations", true);
+
+    /* Using `--ignore-liveness' with `--delete' can have unintended
+       consequences if `gc-keep-outputs' or `gc-keep-derivations' are
+       true (the garbage collector will recurse into deleting the
+       outputs or derivers, respectively).  So disable them. */
+    if (options.action == GCOptions::gcDeleteSpecific && options.ignoreLiveness) {
+        state.gcKeepOutputs = false;
+        state.gcKeepDerivations = false;
+    }
     
     /* Acquire the global GC root.  This prevents
        a) New roots from being added.