fix(tools): run pr_overlap on git older than 2.45 #1229

Merged
hashaam1217 merged 2 commits from upstream-pr/1229 into main 2026-10-08 05:28:28 +00:00
hashaam1217 commented 2026-10-07 18:32:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hashaam1217 on 2026-10-07T18:32:19Z.


What

tools/pr_overlap.py --branch stopped with IndexError: list index out of range on git older than 2.45, such as 2.43 on Ubuntu 24.04 LTS. conflicts() passes the two pull-request-on-main trees to git merge-tree --merge-base=refs/pr/base. git accepts trees there only from 2.45 (RelNotes 2.45.0: "the three trees involved in the 3-way merge only need to be trees, not necessarily commits"). Older git fails with "expected commit type, but the object dereferences to tree type", and merge() then reads the first line of empty output.

  • scan() wraps each clean merge result in a commit on top of refs/pr/base (git commit-tree); hunks() and conflicts() use it. --merge-base with commits works from git 2.40 (RelNotes 2.40.0). The trees being compared are the same, so reports do not change.
  • merge() raises with git's message when git merge-tree fails, instead of reading an empty result.

#819 (DEPENDS regex), #988 (job summary) and #1228 (conflicts()) also touch this file, on other lines. The commit is stored under the existing tree key, so conflicts() is unchanged and #1228 merges cleanly before or after this.

Tested

Ubuntu 24.04.5, git 2.43.0, Python 3.12.3.

  • --branch on the branch of #1218: on main it stops with the IndexError; with the change it prints "No overlap with open pull requests.", which matches a manual git merge-tree check against every open pull request.
  • --branch on the head of #1211: reports conflicts with #1163 (Amd64OnlyConverterTests.cpp L129-130) and #1226 (X64InstructionDecoder.cpp L14, L30-31), so overlaps are still found.
  • --out (the CI mode): on main it stops with the same IndexError; with the change it covers the 200 pull requests it lists and writes 79 non-empty reports in 23 s. The report for #1211 names the same two pull requests as --branch.
  • A failing merge (no-such-ref) raises RuntimeError: git merge-tree ... failed: merge-tree: no-such-ref - not something we can merge.
  • Stacked with #1228 on current main (df16c4c2): merges without conflicts in both orders, and --branch on the result runs on git 2.43. #1228 on its own stops with the same IndexError on git 2.43.
  • tools/check_conventions.py --base origin/main: passed.

CI is not affected: ubuntu-latest has a newer git.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4776828636 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1229). Originally posted by [hashaam1217](https://github.com/hashaam1217) on 2026-10-07T18:32:19Z. --- ### What `tools/pr_overlap.py --branch` stopped with `IndexError: list index out of range` on git older than 2.45, such as 2.43 on Ubuntu 24.04 LTS. `conflicts()` passes the two pull-request-on-main trees to `git merge-tree --merge-base=refs/pr/base`. git accepts trees there only from 2.45 (RelNotes 2.45.0: "the three trees involved in the 3-way merge only need to be trees, not necessarily commits"). Older git fails with "expected commit type, but the object dereferences to tree type", and `merge()` then reads the first line of empty output. - `scan()` wraps each clean merge result in a commit on top of `refs/pr/base` (`git commit-tree`); `hunks()` and `conflicts()` use it. `--merge-base` with commits works from git 2.40 (RelNotes 2.40.0). The trees being compared are the same, so reports do not change. - `merge()` raises with git's message when `git merge-tree` fails, instead of reading an empty result. #819 (`DEPENDS` regex), #988 (job summary) and #1228 (`conflicts()`) also touch this file, on other lines. The commit is stored under the existing `tree` key, so `conflicts()` is unchanged and #1228 merges cleanly before or after this. ### Tested Ubuntu 24.04.5, git 2.43.0, Python 3.12.3. - `--branch` on the branch of #1218: on `main` it stops with the `IndexError`; with the change it prints "No overlap with open pull requests.", which matches a manual `git merge-tree` check against every open pull request. - `--branch` on the head of #1211: reports conflicts with #1163 (`Amd64OnlyConverterTests.cpp` L129-130) and #1226 (`X64InstructionDecoder.cpp` L14, L30-31), so overlaps are still found. - `--out` (the CI mode): on `main` it stops with the same `IndexError`; with the change it covers the 200 pull requests it lists and writes 79 non-empty reports in 23 s. The report for #1211 names the same two pull requests as `--branch`. - A failing merge (`no-such-ref`) raises `RuntimeError: git merge-tree ... failed: merge-tree: no-such-ref - not something we can merge`. - Stacked with #1228 on current `main` (df16c4c2): merges without conflicts in both orders, and `--branch` on the result runs on git 2.43. #1228 on its own stops with the same `IndexError` on git 2.43. - `tools/check_conventions.py --base origin/main`: passed. CI is not affected: `ubuntu-latest` has a newer git. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1229
No description provided.