spawn form: default the worktree toggle off when the directory is already a worktree #91

Closed
opened 2026-08-24 14:28:12 +01:00 by naps62-yolo · 0 comments
Collaborator

The worktree toggle defaults on in any git repo. Picking a directory that is itself a linked worktree therefore asks the daemon to create a second worktree for a branch that is already checked out, and git refuses:

fatal: 'feat/existing' is already used by worktree at '…/worktrees/feat/existing'

Verified against the current build: the spawn fails outright, and the only way through is to notice and turn the toggle off by hand.

Default it off when the chosen directory is a linked worktree. The picker already knows — project rows carry is-worktree — and /api/gitroot can confirm.

The result is that the session simply runs in that directory with no worktree record. That is not adoption: the daemon never created the tree, so it never removes it, a kill is not guarded, and nothing is ever retained for it. See docs/WORKTREES.md; running a session in a directory and owning that directory are different things, and only the second is forbidden.

Apply the same default in the TUI draft pane.

Non-goals: no reuse or adoption of the worktree, and no change to what happens when the toggle is deliberately turned back on — that path should still fail with git's own message (see the separate issue on surfacing it).

The worktree toggle defaults on in any git repo. Picking a directory that is itself a linked worktree therefore asks the daemon to create a *second* worktree for a branch that is already checked out, and git refuses: ``` fatal: 'feat/existing' is already used by worktree at '…/worktrees/feat/existing' ``` Verified against the current build: the spawn fails outright, and the only way through is to notice and turn the toggle off by hand. Default it off when the chosen directory is a linked worktree. The picker already knows — project rows carry `is-worktree` — and `/api/gitroot` can confirm. The result is that the session simply runs in that directory with no worktree record. That is **not** adoption: the daemon never created the tree, so it never removes it, a kill is not guarded, and nothing is ever retained for it. See `docs/WORKTREES.md`; running a session in a directory and owning that directory are different things, and only the second is forbidden. Apply the same default in the TUI draft pane. Non-goals: no reuse or adoption of the worktree, and no change to what happens when the toggle is deliberately turned back on — that path should still fail with git's own message (see the separate issue on surfacing it).
naps62-yolo added this to the Spawn v2 milestone 2026-08-24 14:28:12 +01:00
naps62-yolo added the area/tuiarea/webdifficulty/easytype/fix labels 2026-08-24 14:28:12 +01:00
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: naps62/maestro#91