Skip to content

merge_check: name the git it needs when the one on PATH is older than 2.38 - #8412

Open
Maraco91 wants to merge 1 commit into
ItsNotRexed:mainfrom
Maraco91:fix/merge-check-old-git
Open

Maraco91 wants to merge 1 commit into
ItsNotRexed:mainfrom
Maraco91:fix/merge-check-old-git

Conversation

@Maraco91

Copy link
Copy Markdown

Claimed in the coordination issue as: new TEST item, claim in #8344 (no ID yet). Depends on: nothing open.

What and why

scripts/merge_check.py uses git merge-tree --write-tree, which is new in git 2.38. Its docstring says so, but nothing checks it. A git before 2.38 reads --write-tree as a revision, so on such a PC the tool's only message is git's own:

merge_check: git merge-tree origin/main <ref>: fatal: unknown rev --write-tree

and python -I tests/test_merge_check.py gives 14 errors out of 16 tests. I hit it because the first git on this PC's PATH is 2.37.3, the one Laragon bundles; Git for Windows 2.52 is further down.

The change:

  • scripts/merge_check.py: when merge-tree --write-tree fails, ask git --version. On a git before 2.38 the error is one line that names the release needed and the one found, still exit 2:

    merge_check: git 2.38 or newer is needed for merge-tree --write-tree; the git on PATH is 2.37.3.windows.1
    

    Any other merge-tree failure keeps git's message as before, and a release that cannot be read is not called old. git --version is asked only after a failure, so a run that works starts no extra process.

  • tests/test_merge_check.py: the cases that reach merge-tree skip with that reason on an older git instead of erroring. Four new cases, which run on any git: the one-line message, the unchanged message on a new enough git, which releases count as old, and reading the release from git --version.

Overlap: #7443, #7468, #7291, #7660, #7918, #8016 and #8291 also edit these two files, for other reasons. I'll rebase on whichever lands first.

Tested

Windows 11 26200, Python 3.12.6, at 3e8f9743 (base main 6dda0630). No game files; no GPU is involved.

git first on PATH main this branch
2.37.3.windows.1 16 tests, 14 errors; the tool prints fatal: unknown rev --write-tree 20 tests OK, 14 skipped with the reason; the tool prints the one line above, exit 2
2.52.0.windows.1 16 tests OK 20 tests OK, none skipped; the tool on this repository answers as before (exit 0)
  • Linux (WSL Ubuntu, git 2.43.0, Python 3.12.3): 20 tests OK.
  • Negative control: with main's scripts/merge_check.py and this branch's test file, the test file does not import (merge_check has no git_release), on either git.
  • python -m compileall -q scripts tests/test_merge_check.py and git diff --check: clean. tests/test_ci_registration.py: 14 OK.

Not tested: a git older than 2.37, and macOS.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable.)

AI-assisted (Claude Code).

🤖 Generated with Claude Code

… 2.38

merge-tree --write-tree is new in git 2.38. An older git reads the option as
a revision, so the tool's only message was git's own
"fatal: unknown rev --write-tree", and tests/test_merge_check.py gave 14
errors (seen with git 2.37.3 first on PATH, the one Laragon bundles).

- scripts/merge_check.py: when merge-tree --write-tree fails, ask
  git --version; on a git before 2.38 the error is one line naming the
  release it needs and the one it found, still exit 2. Any other failure
  keeps git's message, and nothing is asked when merge-tree works.
- tests/test_merge_check.py: the cases that reach merge-tree skip with that
  reason on an older git instead of erroring; four new cases cover the
  message, the unchanged message on a new enough git, which releases count
  as old, and reading the release.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@morodirule

Copy link
Copy Markdown

Tested 3e8f974 on Arch Linux, Python 3.14.10, CPU only: pass — first Linux check. tests/test_merge_check.py 20/20 OK. Negative control: base script → loader AttributeError (no git_release); restored, green again. No game files. AI-assisted.

@sergiocr06

Copy link
Copy Markdown

Tested 3e8f974 on Windows 11 Pro (10.0.26300), Python 3.14.7, CPU only (git 2.x for Windows, newer than 2.38, so the old-git path is exercised only by the tests): pass.

  • python -I tests/test_merge_check.py at the head: 20 tests, OK (18.7 s).
  • Against main's scripts/merge_check.py the test file stops at import (git_release does not exist there), as expected.
  • Read the diff: the release is asked only after merge-tree --write-tree fails, an unreadable release is not called old, and the message names both the needed and the found version; exit stays 2 via GitError.

AI-assisted (Claude Code).

@garuspl

garuspl commented Nov 23, 2026

Copy link
Copy Markdown

Tested 3e8f974 on Windows 11 (CPU only, no GPU needed): pass

Windows 11 Pro, Python 3.14.7, no GPU or game files involved; pytest/numpy/Pillow pinned from tests/requirements.txt in a fresh venv. Method: PR head merged onto main d9aa42a, the PR's test files run with python -m pytest before and after the merge, plus python -m compileall -q on the changed files (clean).

  • tests/test_merge_check.py: main 16 passed; with the PR 20 passed, 12 subtests passed.

AI-assisted (Claude Code, Claude Opus 5.5).

@Atomic258

Copy link
Copy Markdown
Contributor

Tested 3e8f9743 on Windows Server 2022, CPython 3.13.12: pass

  • python -I tests/test_merge_check.py -> OK

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants