nflib.git should own the `git worktree list --porcelain` parse nf-jy5l ← Beads

open priority 2 task unassigned

Twinned from https://github.com/cfsh/ninefold/issues/559 by tools/beads/import_github.py's reconcile pass.

Three tools now parse git worktree list --porcelain and none of them share the parse:

spawn_dev.py's copy says so in its own docstring rather than importing across tool domains, which is the right call for one PR and the wrong shape to leave standing.

The uplift: one nflib.git reader — Git.worktrees() -> list[WorktreeInfo] with path, branch, detached, and a worktree_at(path) convenience — with the normcase comparison in one place. Both callers then express their own question in a line, and the Windows path-casing rule stops being something each new caller has to rediscover.

Why it is not free. worktree_registered is load-bearing on the merge path and its narrow semantics are deliberate: saying yes sends the caller down a branch that hard-resets and cleans a tree. Any refactor has to keep "only ever resets a tree it made" exactly as true, and its existing tests are the specification. That is a real job, not a tidy-up — hence filed rather than folded into #557.

Filed unclaimed by nf-dev-office-spawn while working #557 (PR #558). Not on my chunk.

Dependencies

None.

Comments

No comments.

Add a comment