feat(git): a local surface to switch to an existing branch #867
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#868 feat(hooks): steer a plain git switch to madt_switch
sixfold-space/madtea
#870 feat(git): point madt_branch_create's "already exists" refusal at madt_switch
sixfold-space/madtea
#871 fix(orchestrate): name madt_switch instead of raw git checkout
sixfold-space/madtea
Reference
sixfold-space/madtea#867
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The gap
madtea wraps the branch moves that start and finish work.
madt_branch_createcreates and checks out a new branch.madt_finishmerges and returns to the default branch.madt_pull,madt_push,madt_fetch,madt_branch_delete,madt_commit, andmadt_worktreescover the rest. No surface switches to a branch that already exists: back to the default branch, or across to another existing branch.A caller that drives git only through the madt_* tools hits this the moment it changes course. It runs
madt_branch_create, then wants to leave that branch and return to the default branch without finishing it. The only way back is rawgit switchorgit checkout, the exact fallback the tool set exists to remove. The Tier-1 goal is a clean install that drives the forge with no raw-git fallback (ADR 0001), and this one move breaks that goal.This is the shape of #571: every git operation on this path has a madt_* surface except one, and the missing one falls out of the set at the moment it is needed.
What is missing
madt_branch_createalready creates and checks out a new branch. This surface checks out a ref that already exists, and never creates one.Design
switchand the MCP tool ismadt_switch. git'sswitchis the branch-only verb, so it maps one to one to this capability and avoidscheckout's overloaded file form. git still marksswitchexperimental, but only on its newer flags; the plainswitch <branch>behaviour has been stable since git 2.23. ADR 0016 and ADR 0030 anchor the name and shape to git, and the MCP surface keeps its named-parameter form (ADR 0030).madt_branch_createalready does in its own repo.madt_branch_createandmadt_pull. A foreign-primary switch refuses the same way, and names the worktree flow.madt_branch_createalready has.Acceptance criteria
madtea switch <branch>andmadt_switchmove HEAD to an existing local branch, the default branch included, and report the branch and the new short HEAD sha.madt_branch_create; the surface never creates a branch.internal/parity/.Decisions on the open points
I settled the points that the design above left open:
origin/feat-b, with no localfeat-b) is refused. madtea runsgit switch --no-guess, so git never creates a local tracking branch. The error points atmadt_branch_createwithbase=origin/feat-b.madt_branch_create. Untracked files do not count. In my own repo the dirty-tree rule mirrors git, as stated above.switchhas no-c.madt_branch_create.madt_switchjoins the completion set of the closure drift test.git switch.madt_switch.