Synchronize the mingw-w64-git definition with MSYS2#184
Merged
Conversation
This file's goal is to ensure that the compatibility wrapper is
installed into the `<top>\bin\` directory so that e.g.
D:\path\to\msys2\bin\sh.exe -lc "echo Hello"
would work. These wrappers are totally inappropriate for the
mingw-w64-git package and should therefore not be installed via the
`.install` script.
Instead, let's move it to the place that is totally appropriate a place
for this: the mingw-w64-git-for-windows-addons package which already
installs wrappers like `<top>\git-bash.exe`.
This commit is best viewed with `--color-moved`.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
rimrul
reviewed
Feb 10, 2026
The idea of the Git wrapper is that it is installed into various places
(as part of the `mingw-w64-git-for-windows-addons` package), e.g. into
`<msys64>\git-bash.exe`. This executable will then set up the required
environment variables and spawn the actual `bash.exe`.
Likewise, the Git wrapper is installed into `<msys64>\cmd\git.exe`
where it can be called directly from, say, a PowerShell, without needing
to add all the correct `PATH` entries and without setting `MSYSTEM`: the
wrapper will do all that, and then spawn the actual `git.exe` in the
correct subdirectory.
Now, grace to Git for Windows' history, which started out before MSYS2
was invented and was based on MSys and MinGW instead, the actual logic
grew organically. In the early days, when Git for Windows only supported
i686 builds, all of those environment variable values were hardcoded.
Later, when Git for Windows was moved on top of MSYS2, only two values
were possible: "MINGW64" and "MINGW32". When timid steps were taken to
support Windows/ARM64, a third option was added: "CLANGARM64".
All this was unnecessary, though: The environment variable `MSYSTEM` is
set when building the mingw-w64-git package, and it is guaranteed to be
set to the very value the Git wrapper wants to use at run-time.
So let's stop hard-coding the MINGW{32,64} values, and drop the hack we
needed in Git for Windows while the clangarm64 builds were only
experimental.
Instead, just use the value in the environment variable `MSYSTEM` at
build time, hard-coding _that_ into the binary. This will allow the Git
wrapper to find the executables that were put into the corresponding
`mingw-w64-git-*` packages.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
d38c1be to
eb05020
Compare
rimrul
approved these changes
Feb 14, 2026
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 upstreamed the package definition, I needed to perform a couple of adjustments. Let's pull them into Git for Windows proper, so that next time the sync can result in an identical
mingw-w64-git/subdirectory (currently, there are changes in Git for Windows already that did not make it into MSYS2 yet, from #182 and #183, which cause a temporary divergence).