Skip to main content

worktree_prune

Function worktree_prune 

Source
pub async fn worktree_prune(repo: &Path) -> Result<()>
Expand description

Drop registrations for worktrees whose directory is already gone.

git worktree remove already does this for the path it just removed, but a directory deleted by hand - crate::clean::fold_orphaned_worktrees, or an operator’s own rm -rf - leaves the registration behind, and a registered path refuses a fresh worktree add until something prunes it. The operator’s own machine had 31 such registrations sitting in one repository, all of them for directories that no longer existed.