resume picker: make worktree porcelain parsing block-scoped (trail finding)

main

Commit

Soph3mo ago

Factor the git worktree list --porcelain parsing in branchCheckedOutElsewhere into parseWorktreeForBranch and make it block-scoped: reset the worktree path at each blank-line block boundary and only consider a branch line when a worktree line was seen in the same block. A detached worktree (no branch line) can no longer pair a branch with a stale path or return an empty path. Also drops the now-dead rawRoot!="" guard (the empty case returns earlier).

Adds TestParseWorktreeForBranch covering a detached worktree.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com Entire-Checkpoint: dc7a0655039b

Checkpoints

Interactive Resume Picker for Sessions

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1