Skip to main content

obstacle_from_listing

Function obstacle_from_listing 

Source
fn obstacle_from_listing(
    entries: &[ListedWorktree],
    repo: &Path,
    branch: &str,
    path: &Path,
) -> Option<String>
Expand description

The obstacle the listing describes: the branch held at another path, or what git has registered at path and will not reuse.

The second decision reads the worktree’s own gitdir LINK, not git’s prunable line: a LOCKED entry carries no such line on any git version (and claude locks every worktree it creates), while a git older than 2.36 carries none for anything - so the line cannot tell a registration whose gitdir is gone from one whose gitdir is there, which is the half the link answers. worktree_gitdir_resolves then asks whether that gitdir is one git can actually reuse, so a present-but-unusable registration is refused here rather than left for the add.