Skip to content

Synchronize the mingw-w64-git definition with MSYS2#184

Merged
dscho merged 2 commits intomainfrom
sync-git-with-msys2
Feb 14, 2026
Merged

Synchronize the mingw-w64-git definition with MSYS2#184
dscho merged 2 commits intomainfrom
sync-git-with-msys2

Conversation

@dscho
Copy link
Member

@dscho dscho commented Feb 9, 2026

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).

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>
@dscho dscho requested review from mjcheetham and rimrul February 9, 2026 15:09
@dscho dscho self-assigned this Feb 9, 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>
@dscho dscho force-pushed the sync-git-with-msys2 branch from d38c1be to eb05020 Compare February 13, 2026 17:59
@dscho dscho merged commit bc476e5 into main Feb 14, 2026
3 checks passed
@dscho dscho deleted the sync-git-with-msys2 branch February 14, 2026 13:26
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.

2 participants