no way to resync a stale local branch to its upstream without raw git #571
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.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea#571
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
A local
mainthat has diverged fromorigin/maincannot be brought back in line through any madtea surface.madt_statusreports the divergence and then hands the user off to raw git:"Use your own shell" is the wrong answer for the tool that exists so nobody has to. Every other git operation on this path has a madtea surface:
madt_pull,madt_push,madt_fetch,madt_branch_create,madt_branch_delete,madt_worktrees,madt_commit. Reconciling a branch with its upstream is the one common operation that falls out of the set, and it falls out exactly when a repo is in the state most likely to cause damage.Nothing else covers it:
madt_pullmerges, andrebase=truereplays the local commits. With a branch that is ahead AND behind, both produce a wrong result: a merge commit over commits that should not exist, or 153 rebased duplicates.madt_push --force-with-leasepushes the wrong direction.madt_branch_deleterefuses an unmerged branch, and cannot touch a checked-out default branch anyway.The real case
madtea-site's local
mainsits ahead 153 and behind 155. The 153 are stale duplicates: every PR was squash-merged, so the content landed upstream under different SHAs.git ls-treeon both refs confirms localmainholds no unique content at all. The correct action is to discard those 153 and take the remote, and there is no way to ask madtea to do it.It is not a cosmetic problem. In that state
madt_finish dir=<primary>is blocked outright by an identity guard that reads the primary's HEAD and finds 127 commits authored under a since-retired identity. The repo is unusable through its normal surface until a human runs raw git.Proposed shape
A resync that is safe by construction, refusing whenever local-only work would be lost:
It should:
madt_branch_deletealready refuses an unmerged branch. No force flag on this surface.The safety analysis already exists in the codebase.
madt_branch_delete's refusal returnscherry_equivalent,tree_identical,likely_squash_mergedandahead_unique. That is precisely the squash-merge detection this needs. The new surface should reuse it rather than grow a second implementation.Acceptance criteria
madt_branch_delete's refusal shape, so callers branch on fields and not prose.madt_status's "push or reset from your own shell as needed" is replaced by a pointer to this call.