pub fn remove_tree_beneath(
label: &Path,
parent: &File,
name: &OsStr,
expected: Option<ObjectId>,
) -> Result<Removal, String>Expand description
What:
Remove the directory name below parent with everything in it; label is the path of parent, used only in messages.
Why:
With expected set, the directory is removed only when it is that object: the identity is compared by name before the
directory is opened and again on the opened object, so a replacement made between the two is left alone. The top
directory must be on the device of parent. Nothing is followed and nothing outside the directory is touched. An entry
that vanishes meanwhile counts as removed. Directories are entered with a work stack, so depth costs no recursion.
In TS you’d write (pseudocode):
const removal = await removeTreeBeneath({ label, parent, name, expected }); // 'removed' | 'absent'