feat(pulls/merge): add --delete-branch flag #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "maximus/feat/delete-branch-flag"
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?
Summary
Surfaces the existing
DeleteBranchAfterMergefield from the Gitea SDK'sMergePullRequestOptionontea pr merge, so callers can opt into deleting the head branch after a successful merge. Mirrors the web UI's "Delete branch after merge" checkbox.Behaviour
tea pr merge 42default_delete_branch_after_mergesetting (status quo).tea pr merge 42 --delete-branchtea pr merge --delete-branch(interactive)Pointer-to-bool semantics keep "omitted" distinct from "explicitly false". If a future caller needs to override the repo default to-false explicitly, switch to IsSet()-aware threading then; not needed today.
Why
Surfaced on srv-mirus on 2026-05-06: the
Optimacro/tf-sgm-mirustech-data-generation-ip-temporaryrepo hasdefault_delete_branch_after_merge=true, buttea pr mergedoesn't pass the field, so merged feature branches were surviving and accumulating. ManualDELETE /branchescalls were the workaround. Once this lands,tea pr merge --delete-branch(or a repo where the server-side default fires server-side) cleans up automatically.Test plan
make testpasses (no Go toolchain on the host this was authored on; build deferred to CI).tea pr mergewith no args from a branch that has an open PR).Closing in favour of model A architecture —
mainstays a clean upstream mirror, local patches accumulate on a long-livedrelease/mirusbranch, releases are tagged there. The replacement PR will targetrelease/mirus.Pull request closed