File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -717,6 +717,15 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
717
717
} catch (InvalidPath &) { }
718
718
};
719
719
720
+ if (options.action == GCOptions::gcDeleteSpecific
721
+ && !options.pathsToDelete .count (*path))
722
+ {
723
+ throw Error (
724
+ " Cannot delete path '%s' because it's referenced by path '%s'." ,
725
+ printStorePath (start),
726
+ printStorePath (*path));
727
+ }
728
+
720
729
/* If this is a root, bail out. */
721
730
if (auto i = roots.find (*path); i != roots.end ()) {
722
731
if (options.action == GCOptions::gcDeleteSpecific)
@@ -728,15 +737,6 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
728
737
return markAlive ();
729
738
}
730
739
731
- if (options.action == GCOptions::gcDeleteSpecific
732
- && !options.pathsToDelete .count (*path))
733
- {
734
- throw Error (
735
- " Cannot delete path '%s' because it's referenced by path '%s'." ,
736
- printStorePath (start),
737
- printStorePath (*path));
738
- }
739
-
740
740
{
741
741
auto hashPart = std::string (path->hashPart ());
742
742
auto shared (_shared.lock ());
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ if nix-store --gc --print-dead | grep -E "$outPath"$; then false; fi
23
23
nix-store --gc --print-dead
24
24
25
25
inUse=$( readLink " $outPath /reference-to-input-2" )
26
- expectStderr 1 nix-store --delete " $inUse " | grepQuiet " Cannot delete path.*because it's referenced by the GC root "
26
+ expectStderr 1 nix-store --delete " $inUse " | grepQuiet " Cannot delete path.*because it's referenced by path ' "
27
27
test -e " $inUse "
28
28
29
29
expectStderr 1 nix-store --delete " $outPath " | grepQuiet " Cannot delete path.*because it's referenced by the GC root "
You can’t perform that action at this time.
0 commit comments