fix(refinery): delete remote polecat branches after merge (#369)
Since the self-cleaning model (Jan 10), polecats push branches to origin before `gt done`. The refinery was only deleting local branches after merge, causing stale `polecat/*` branches to accumulate on the remote. Now deletes both local and remote branches after successful merge. Uses existing `git.DeleteRemoteBranch()` function. Remote deletion is non-fatal if the branch doesn't exist. Fixes #359
This commit is contained in:
@@ -445,13 +445,21 @@ func (e *Engineer) handleSuccess(mr *beads.Issue, result ProcessResult) {
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Delete source branch if configured (local only - branches never go to origin)
|
||||
// 4. Delete source branch if configured (local and remote)
|
||||
// Since the self-cleaning model (Jan 10), polecats push to origin before gt done,
|
||||
// so we need to clean up both local and remote branches after merge.
|
||||
if e.config.DeleteMergedBranches && mrFields.Branch != "" {
|
||||
if err := e.git.DeleteBranch(mrFields.Branch, true); err != nil {
|
||||
_, _ = fmt.Fprintf(e.output, "[Engineer] Warning: failed to delete branch %s: %v\n", mrFields.Branch, err)
|
||||
_, _ = fmt.Fprintf(e.output, "[Engineer] Warning: failed to delete local branch %s: %v\n", mrFields.Branch, err)
|
||||
} else {
|
||||
_, _ = fmt.Fprintf(e.output, "[Engineer] Deleted local branch: %s\n", mrFields.Branch)
|
||||
}
|
||||
// Also delete the remote branch (non-fatal if it doesn't exist)
|
||||
if err := e.git.DeleteRemoteBranch("origin", mrFields.Branch); err != nil {
|
||||
_, _ = fmt.Fprintf(e.output, "[Engineer] Warning: failed to delete remote branch %s: %v\n", mrFields.Branch, err)
|
||||
} else {
|
||||
_, _ = fmt.Fprintf(e.output, "[Engineer] Deleted remote branch: origin/%s\n", mrFields.Branch)
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Log success
|
||||
|
||||
Reference in New Issue
Block a user