Skip to content

Fix msys2-runtime version detection once again#167

Merged
dscho merged 3 commits into
mainfrom
fix-msys2-runtime-version-detection-once-again
Apr 28, 2026
Merged

Fix msys2-runtime version detection once again#167
dscho merged 3 commits into
mainfrom
fix-msys2-runtime-version-detection-once-again

Conversation

@dscho
Copy link
Copy Markdown
Member

@dscho dscho commented Apr 25, 2026

When I tried to /open-pr the MSYS2-packages PR to update to Cygwin runtime v3.6.9, it once again failed to determine the correct version. Instead of 3.6.9-1, it thought that I wanted to deploy 3.6.7-5.

The fix requires git-for-windows/MSYS2-packages@01bfb78, and the corresponding change in git-for-windows-automation. This PR sports that change, along with two more fixes for issues I noticed while trying to reproduce the original issue.

dscho added 3 commits April 25, 2026 00:30
On incremental runs, `src/msys2-runtime` already exists from a
previous invocation. The `worktree add` command fails with
"'src/msys2-runtime' already exists" in that case. Since the
directory may contain valuable data (such as reflogs from prior
work), simply skip the `worktree add` when the directory is
already present.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The `git describe --match='cygwin-[0-9]*'` approach picks the
wrong base tag in the msys2-runtime's merging-rebase topology.
For the revision 6abc3bb22b4, describe reports `cygwin-3.6.7`
(at depth 21396) while the actually closest ancestor tag is
`cygwin-3.6.9` (at distance 21368 by commit count). This caused
the `open-pr` workflow to produce a `3.6.7-5` PR when it should
have detected an upgrade to `3.6.9`.

Replace `describe` with `for-each-ref --format='%(ahead-behind)'`
sorted by distance. The `sed` filter ensures only clean release
tags (`cygwin-X.Y.Z`, not `-dev` suffixes) are considered, and
the `head -n 1` picks the closest ancestor.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The `src/msys2-runtime` directory is an independent clone, not a
worktree of the bare `msys2-runtime` repository. Objects fetched
into the bare repo (including the target revision and the cygwin-*
tags) are invisible to `src/msys2-runtime`. This means
`update-patches.sh`, which operates on `src/msys2-runtime`,
cannot find the correct base tag or the target revision.

Set up an alternates file so `src/msys2-runtime` borrows objects
from the bare repo, then use `update-ref` to point HEAD at the
target revision and create the base tag. The alternates path is
relative so both `/usr/bin/git.exe` and `/mingw64/bin/git.exe`
can resolve it.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho self-assigned this Apr 25, 2026
@dscho dscho requested review from mjcheetham and rimrul April 25, 2026 10:18
@dscho dscho merged commit 5c1a6b8 into main Apr 28, 2026
@dscho dscho deleted the fix-msys2-runtime-version-detection-once-again branch April 28, 2026 06:34
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.

1 participant