Fix msys2-runtime version detection once again#167
Merged
Conversation
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>
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.
When I tried to
/open-prthe 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.