handle merge queue rewrites in sync prune#732
Conversation
Current Aviator status
This pull request is currently open (not queued). How to mergeTo merge this PR, comment
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
🔃 FlexReview StatusCommon Owner:
Review SLO: |
There was a problem hiding this comment.
Code Review
This pull request enhances the branch pruning logic to handle cases where merge queues rebase or squash commits, causing local branch SHAs to diverge from the remote PR head. It introduces two fallback checks: branchFullyPatchMerged using git cherry for rebase merges and branchSquashMergedByTree using git merge-tree for squash merges. Comprehensive end-to-end tests were added to verify these scenarios and ensure branches with unpushed work are not accidentally deleted. Feedback suggests using the more explicit ^1 notation when referencing the parent of a merge commit for better clarity.
| return false | ||
| } | ||
| ctx := context.Background() | ||
| mergeParent := mergeCommitSHA + "^" |
There was a problem hiding this comment.
Using ^ to refer to the parent of the merge commit is generally correct for squash merges and standard merge commits (where it defaults to the first parent). However, it might be more explicit to use ^1 or ~1 to clearly indicate that we are comparing against the state of the trunk branch before the merge occurred.
| mergeParent := mergeCommitSHA + "^" | |
| mergeParent := mergeCommitSHA + "^1" |
248ce57 to
501e8c0
Compare
merge queues rewrite pr commits so refs/pull/N/head diverges from the local tip by sha, which made the old prune check refuse to delete those branches. adds patch-id and merge-tree fallbacks