fix(hooks): a raw switch in a foreign linked worktree is denied as a foreign primary #869

Open
opened 2026-10-22 17:30:44 +00:00 by hexajon · 0 comments
Owner

The gap

I ran a plain git switch v0.20.0 in a linked worktree that madt_worktrees action=add created for a scratch repo outside the session's directory. The local-git hook denied it with "Moving the PRIMARY checkout of a foreign repo is not allowed". The target was a linked worktree, not a primary. I have not checked why the hook classified it as a primary.

Repro

  1. A scratch repo outside the session directory, with a linked worktree made by madt_worktrees action=add dir=<repo> path=.worktrees/wt branch=wt.
  2. In Bash: cd <repo>/.worktrees/wt && git switch <tag>.
  3. The hook denies it with the foreign-primary text.

What I want

  • The hook treats a linked worktree of a foreign repo as a linked worktree, as ADR 0019 says.

Acceptance criteria

  • The cause is found and stated on this issue.
  • A hook test covers a raw switch in a foreign linked worktree.
## The gap I ran a plain `git switch v0.20.0` in a linked worktree that `madt_worktrees action=add` created for a scratch repo outside the session's directory. The local-git hook denied it with "Moving the PRIMARY checkout of a foreign repo is not allowed". The target was a linked worktree, not a primary. I have not checked why the hook classified it as a primary. ## Repro 1. A scratch repo outside the session directory, with a linked worktree made by `madt_worktrees action=add dir=<repo> path=.worktrees/wt branch=wt`. 2. In Bash: `cd <repo>/.worktrees/wt && git switch <tag>`. 3. The hook denies it with the foreign-primary text. ## What I want - The hook treats a linked worktree of a foreign repo as a linked worktree, as ADR 0019 says. ## Acceptance criteria - [ ] The cause is found and stated on this issue. - [ ] A hook test covers a raw switch in a foreign linked worktree.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea#869
No description provided.