From 195bf95a85310a4edfeef0eb54271e490d85ee70 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 15 Apr 2025 18:24:48 +0200 Subject: [PATCH] fixup! mingw: allow `git.exe` to be used instead of the "Git wrapper" When this commit was originally introduced, Windows/ARM64 support was a fantasy. In the meantime it is reality and we need to do a better job of setting `MSYSTEM` and the `PATH`: We want to support Windows/ARM64 properly. Signed-off-by: Johannes Schindelin --- compat/mingw.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index 11173e6b2f..0a0ef922da 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -3613,6 +3613,10 @@ static size_t append_system_bin_dirs(char *path, size_t size) strip_suffix_mem(prefix, &len, "\\mingw64\\bin")) off += xsnprintf(path + off, size - off, "%.*s\\mingw64\\bin;", (int)len, prefix); + else if (strip_suffix_mem(prefix, &len, "\\clangarm64\\libexec\\git-core") || + strip_suffix_mem(prefix, &len, "\\clangarm64\\bin")) + off += xsnprintf(path + off, size - off, + "%.*s\\clangarm64\\bin;", (int)len, prefix); else if (strip_suffix_mem(prefix, &len, "\\mingw32\\libexec\\git-core") || strip_suffix_mem(prefix, &len, "\\mingw32\\bin")) off += xsnprintf(path + off, size - off, @@ -3718,9 +3722,13 @@ static void setup_windows_environment(void) char buf[32768]; size_t off = 0; - xsnprintf(buf, sizeof(buf), - "MINGW%d", (int)(sizeof(void *) * 8)); - setenv("MSYSTEM", buf, 1); +#if defined(__MINGW64__) || defined(_M_AMD64) + setenv("MSYSTEM", "MINGW64", 1); +#elif defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC) + setenv("MSYSTEM", "CLANGARM64", 1); +#else + setenv("MSYSTEM", "MINGW32", 1); +#endif if (home) off += xsnprintf(buf + off, sizeof(buf) - off,