From 874c21bce6232fc96be0944af29541a44100c2d4 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 30 Apr 2025 16:16:05 +0200 Subject: [PATCH] fixup! mingw: allow `git.exe` to be used instead of the "Git wrapper" This patch makes it so that Git really sets the desired `MSYSTEM` on Windows/ARM64. The reason this did not work (and my faulty tests did not catch that before merging https://github.com/git-for-windows/git/pull/5586) is that clang (at least version 20.1.3 as built from https://github.com/git-for-windows/MINGW-packages 8df0c2fff4184deff15acce9bfd791fb6e0d60fe) predefines the `__MINGW64__` constant: $ echo | clang -dM -E - | grep -n MINGW64 249:#define __MINGW64__ 1 Let's just switch the order between the CLANGARM64 and the MINGW64 test; This will still work for MINGW64 because none of the constants used in the CLANGARM64 condition are defined for x64 gcc (or for that matter, clang). Signed-off-by: Johannes Schindelin --- compat/mingw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index 0a0ef922da..bae59f27fb 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -3722,10 +3722,10 @@ static void setup_windows_environment(void) char buf[32768]; size_t off = 0; -#if defined(__MINGW64__) || defined(_M_AMD64) - setenv("MSYSTEM", "MINGW64", 1); -#elif defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC) +#if defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC) setenv("MSYSTEM", "CLANGARM64", 1); +#elif defined(__MINGW64__) || defined(_M_AMD64) + setenv("MSYSTEM", "MINGW64", 1); #else setenv("MSYSTEM", "MINGW32", 1); #endif