Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions internal/handler/sync/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,22 @@ func (h *Handler) SyncTrunk(ctx context.Context, opts *TrunkOptions) (retErr err
if err != nil {
return fmt.Errorf("find finished CRs: %w", err)
}
// Also detect branches merged by force-push to trunk directly.
// The forge API won't report these as merged since there's no
// change-request lifecycle, but the local commit history shows
// the branch head is reachable from the updated trunk.
localMerged, err := h.findLocalMergedBranches(ctx, candidates, trunkEndHash)
if err != nil {
return fmt.Errorf("find locally merged branches: %w", err)
}
for _, b := range localMerged {
if !slices.ContainsFunc(branchesToDelete, func(d branchDeletion) bool {
return d.BranchName == b.BranchName
}) {
h.Log.Infof("%v was merged", b.BranchName)
branchesToDelete = append(branchesToDelete, b)
}
}
}

if len(branchesToDelete) == 0 {
Expand Down