Skip to main content

detached_unique_tip

Function detached_unique_tip 

Source
fn detached_unique_tip(repo_root: &Path, path: &Path) -> Option<String>
Expand description

The full sha of a detached worktree HEAD holding commits that only the worktree itself reaches, or None when removal cannot strand anything. An attached branch is judged after removal by reap_worktree_branch; a detached HEAD must be judged before.

The survivors are refs plus every OTHER worktree’s HEAD. --all cannot serve here: it includes this worktree’s own HEAD, against which nothing ever reads unique, so the guard would never fire. Any failure to verify returns a tip, keeping the tree.