forked from lix-project/lix
* Garbage collector fix: allow deletion of paths that have invalid
(but substitutable) referers.
This commit is contained in:
parent
d5219a351a
commit
f3660b1c8c
|
@ -737,10 +737,10 @@ void deleteFromStore(const Path & _path)
|
||||||
Transaction txn(nixDB);
|
Transaction txn(nixDB);
|
||||||
if (isValidPathTxn(txn, path)) {
|
if (isValidPathTxn(txn, path)) {
|
||||||
PathSet referers = getReferers(txn, path);
|
PathSet referers = getReferers(txn, path);
|
||||||
if (referers.size() > 1 ||
|
for (PathSet::iterator i = referers.begin();
|
||||||
(referers.size() == 1 &&
|
i != referers.end(); ++i)
|
||||||
*referers.begin() != path))
|
if (*i != path && isValidPathTxn(txn, *i))
|
||||||
throw Error(format("cannot delete path `%1%' because it is in use") % path);
|
throw Error(format("cannot delete path `%1%' because it is in use by path `%2%'") % path % *i);
|
||||||
invalidatePath(txn, path);
|
invalidatePath(txn, path);
|
||||||
}
|
}
|
||||||
txn.commit();
|
txn.commit();
|
||||||
|
|
Loading…
Reference in a new issue