mirror of
https://github.com/NixOS/nix.git
synced 2025-11-11 04:56:01 +01:00
Fix test
This commit is contained in:
parent
31b00218fe
commit
71aecfc481
2 changed files with 10 additions and 10 deletions
|
|
@ -717,6 +717,15 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
||||||
} catch (InvalidPath &) { }
|
} catch (InvalidPath &) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (options.action == GCOptions::gcDeleteSpecific
|
||||||
|
&& !options.pathsToDelete.count(*path))
|
||||||
|
{
|
||||||
|
throw Error(
|
||||||
|
"Cannot delete path '%s' because it's referenced by path '%s'.",
|
||||||
|
printStorePath(start),
|
||||||
|
printStorePath(*path));
|
||||||
|
}
|
||||||
|
|
||||||
/* If this is a root, bail out. */
|
/* If this is a root, bail out. */
|
||||||
if (auto i = roots.find(*path); i != roots.end()) {
|
if (auto i = roots.find(*path); i != roots.end()) {
|
||||||
if (options.action == GCOptions::gcDeleteSpecific)
|
if (options.action == GCOptions::gcDeleteSpecific)
|
||||||
|
|
@ -728,15 +737,6 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
||||||
return markAlive();
|
return markAlive();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.action == GCOptions::gcDeleteSpecific
|
|
||||||
&& !options.pathsToDelete.count(*path))
|
|
||||||
{
|
|
||||||
throw Error(
|
|
||||||
"Cannot delete path '%s' because it's referenced by path '%s'.",
|
|
||||||
printStorePath(start),
|
|
||||||
printStorePath(*path));
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto hashPart = std::string(path->hashPart());
|
auto hashPart = std::string(path->hashPart());
|
||||||
auto shared(_shared.lock());
|
auto shared(_shared.lock());
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ if nix-store --gc --print-dead | grep -E "$outPath"$; then false; fi
|
||||||
nix-store --gc --print-dead
|
nix-store --gc --print-dead
|
||||||
|
|
||||||
inUse=$(readLink "$outPath/reference-to-input-2")
|
inUse=$(readLink "$outPath/reference-to-input-2")
|
||||||
expectStderr 1 nix-store --delete "$inUse" | grepQuiet "Cannot delete path.*because it's referenced by the GC root "
|
expectStderr 1 nix-store --delete "$inUse" | grepQuiet "Cannot delete path.*because it's referenced by path '"
|
||||||
test -e "$inUse"
|
test -e "$inUse"
|
||||||
|
|
||||||
expectStderr 1 nix-store --delete "$outPath" | grepQuiet "Cannot delete path.*because it's referenced by the GC root "
|
expectStderr 1 nix-store --delete "$outPath" | grepQuiet "Cannot delete path.*because it's referenced by the GC root "
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue