Repository navigation
merge_check: say when a PR is already on main without a merge of its own (stacked PRs) - #8666
Open
berkay8987 wants to merge 1 commit into
Open
berkay8987 wants to merge 1 commit into
berkay8987 wants to merge 1 commit into
Conversation
A stacked PR squash-merged inside the PR above it, or a change that landed under another commit, has no merge under its own number, so the script called it `clean` (or `conflict` once main had edited its lines), never "already on main". - `already-on-main`: no merge of the PR is found, but the conflict-free merged tree matches main, so merging it changes nothing. - `on_main_outside_conflicts`: with a conflict, whether the merge with every conflicting hunk resolved to main's side (merge-tree -X ours) leaves main as it is. The verdict stays `conflict`; null where git cannot make that merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested 68a3362 on Linux, Python 3.14.4, git 2.53.0: pass
|
1 of 2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: new BUILD item, #8504 (comment)
Depends on: #7468, #7660 and #8291, in the sense the template asks for: each edits
scripts/merge_check.pyclose to the lines this one does andgit merge-treereports a conflict with each, so whichever lands second needs a small rebase. It also goes together with #8564 (no textual conflict); #8564's commit3198b20keeps its--depth 5000test true with this change.What and why
already-mergedneeds a merge under the PR's own number ("Merge pull request #N" or a subject ending in "(#N)"). A PR whose change landed another way never has one:The script calls those
clean, orconflictonce main has edited their lines, never "already on main". Both versions of the script on the real PRs, read-only, againstmain867d922f:cleanalready-on-maincleanalready-on-mainconflictconflict, nothing outside the conflictsconflictconflict, nothing outside the conflictsconflictconflictTwo additions:
already-on-main: no merge of the PR is found, but the conflict-free merged tree matches main, so merging it changes nothing. It ranks afteralready-mergedand beforeduplicates, and exits 1 like every verdict butclean.on_main_outside_conflicts(a JSON field, and a clause in the text line): with a conflict, whether the merge with every conflicting hunk resolved to main's side (merge-tree -X ours) leaves main as it is. The verdict staysconflict, because a PR whose every change conflicts looks the same; it is a hint for whoever reads the report, not a verdict. It isnullwithout a conflict and where git cannot make that merge (a conflict-X oursdoes not settle, or a git whosemerge-treetakes no-X), so the script still runs on git 2.38.One existing expectation changes. In
test_a_multi_commit_squash_merged_pr_is_already_merged_despite_cherry_miss,999=sq2still finds no merge of #999, which is what that check is about; butsq2's content is on main, so it now readsalready-on-main(exit 1) instead ofclean.Tested
python -I tests/test_merge_check.pyon this branch's tree: 19 tests, OK (16, plus 3 new: a stacked PR squash-merged inside the one above it; the same once main edits its lines; a conflicting PR that adds more, which is not said to be on main). With the script change taken out, the three new tests and the changed999=sq2check fail.python -m compileallandpython -I scripts/check_no_game_data.pyon both files: OK.AI-assisted: yes (Claude Code)
Checklist
docs/design.md, with how it was confirmed. (No translator rule here.)🤖 Generated with Claude Code