Skip to main content

remove_owned_worktree

Function remove_owned_worktree 

Source
pub fn remove_owned_worktree(
    repo: &Path,
    label: &str,
    path: &Path,
    force: bool,
) -> Result<(), WorktreeError>
Expand description

Remove a worktree whose removal this repo admitted - a despawn, or a refused spawn’s rollback - recording the admission before git runs. A removal that dies part-way leaves the record behind, which is what lets remove_orphaned_worktree_dir prove the leftover is ours after a repo move; a completed removal clears it.

A path that is already gone admits nothing: a removing record for it would outlive the directory it described and could later authorize deleting a new worktree that reused the label, so cleared is written instead.