diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-09-17 13:46:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-17 13:46:26 +0200 |
commit | b94a35ef40437e8ba6eff561697e7d4a6b8d053a (patch) | |
tree | 1ea99bc5f549aee5aea1284e7fe894ba896a82bf /src | |
parent | fe5cbfd48ff863f21a20b84e324ecfd6395673cb (diff) | |
parent | 520895b1dac1b82be9f571df3981a15cfada2968 (diff) |
Merge pull request #4027 from tweag/fix-gc-of-ca-derivations
Fix garbage collection of CA derivations
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/gc.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index e6cbc525d..08b53c702 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -574,9 +574,12 @@ bool LocalStore::canReachRoot(GCState & state, StorePathSet & visited, const Sto /* If keep-derivations is set and this is a derivation, then don't delete the derivation if any of the outputs are alive. */ if (state.gcKeepDerivations && path.isDerivation()) { - for (auto & i : queryDerivationOutputs(path)) - if (isValidPath(i) && queryPathInfo(i)->deriver == path) - incoming.insert(i); + for (auto & [name, maybeOutPath] : queryPartialDerivationOutputMap(path)) + if (maybeOutPath && + isValidPath(*maybeOutPath) && + queryPathInfo(*maybeOutPath)->deriver == path + ) + incoming.insert(*maybeOutPath); } /* If keep-outputs is set, then don't delete this path if there |