{"thread":{"id":"66125","subject":"[PATCH 00/12] Upstream some more Git for Windows' patches","startedAt":"2026-08-05T14:26:46Z","lastAt":"2026-09-11T13:26:35Z","messageCount":71,"participants":["Johannes Schindelin via GitGitGadget","Junio C Hamano","Johannes Schindelin","Johannes Sixt","Oswald Buddenhagen"],"isPatch":true,"patchVersion":1,"patchTotal":12},"messages":[{"id":"549710","messageId":"pull.2195.git.1785939999.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":null,"subject":"[PATCH 00/12] Upstream some more Git for Windows' patches","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:26Z","receivedAt":"2026-08-05T14:26:46Z","isPatch":true,"body":"When rebasing a Git for Windows commit to enable Rust in Windows CI, I\nnoticed just how many of the preceding commits touching adjacent code\nhaven't been upstreamed yet. This patch series rectifies that.\n\nJohannes Schindelin (12):\n  mingw: include the Python parts in the build\n  mingw: stop hard-coding `CC = gcc`\n  mingw: drop the -D_USE_32BIT_TIME_T option\n  mingw: only use -Wl,--large-address-aware for 32-bit builds\n  mingw: avoid over-specifying `--pic-executable`\n  mingw: set the prefix and HOST_CPU as per MSYS2's settings\n  mingw: only enable the MSYS2-specific stuff when compiling in MSYS2\n  mingw: rely on MSYS2's metadata instead of hard-coding it\n  windows: skip linking `git-<command>` for built-ins\n  mingw: always define `ETC_*` for MSYS2 environments\n  mingw: ensure valid CTYPE\n  mingw: allow `git.exe` to be used instead of the \"Git wrapper\"\n\n compat/mingw.c                      | 68 +++++++++++++++++++++++++++++\n config.mak.uname                    | 61 ++++++++++++--------------\n contrib/buildsystems/CMakeLists.txt |  9 +++-\n meson.build                         | 13 +++++-\n meson_options.txt                   |  4 ++\n t/t0060-path-utils.sh               | 33 +++++++++++++-\n 6 files changed, 151 insertions(+), 37 deletions(-)\n\n\nbase-commit: 5b2471720c93ee30e5764a19f3d3b3ae9ec9712a\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2195%2Fdscho%2Fupstream-some-more-git-for-windows-patches-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2195/dscho/upstream-some-more-git-for-windows-patches-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/2195\n-- \ngitgitgadget\n"},{"id":"549713","messageId":"fd594ffa6cfacaf7896ab312d51d39f30d09be81.1785939999.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH 01/12] mingw: include the Python parts in the build","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:27Z","receivedAt":"2026-08-05T14:26:47Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWhile Git for Windows does not _ship_ Python (in order to save on\nbandwidth), MSYS2 provides very fine Python interpreters that users can\neasily take advantage of, by using Git for Windows within its SDK.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 9ebd240378..8dd8acfaa5 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -781,6 +781,7 @@ ifeq ($(uname_S),MINGW)\n \tHAVE_LIBCHARSET_H = YesPlease\n \tUSE_GETTEXT_SCHEME = fallthrough\n \tUSE_LIBPCRE = YesPlease\n+\tNO_PYTHON =\n         ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n \t\t# Move system config into top-level /etc/\n \t\tETC_GITCONFIG = ../etc/gitconfig\n-- \ngitgitgadget\n\n"},{"id":"549711","messageId":"47fc97458247529f9d2205cd7c0bdf5125ad8832.1785939999.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH 02/12] mingw: stop hard-coding `CC = gcc`","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:28Z","receivedAt":"2026-08-05T14:26:48Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThis is no longer true in general, not with supporting Clang out of the\nbox.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 8dd8acfaa5..a464b2009c 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -771,7 +771,6 @@ ifeq ($(uname_S),MINGW)\n \t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n \t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n         endif\n-\tCC = gcc\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n \t\t-fstack-protector-strong\n \tEXTLIBS += -lntdll\n-- \ngitgitgadget\n\n"},{"id":"549714","messageId":"53f1fd576379a7331e827a2384605a1445f85d86.1785939999.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH 03/12] mingw: drop the -D_USE_32BIT_TIME_T option","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:29Z","receivedAt":"2026-08-05T14:26:50Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThis option was added in fa93bb20d72 (MinGW: Fix stat definitions to\nwork with MinGW runtime version 4.0, 2013-09-11), i.e. a _long_ time\nago. So long, in fact, that it still targeted MinGW. But we switched to\nmingw-w64 in 2015, which seems not to share the problem, and therefore\ndoes not require a fix.\n\nEven worse: This flag is incompatible with UCRT64, which we are about to\nsupport by way of upstreaming `mingw-w64-git` to the MSYS2 project, see\nhttps://github.com/msys2/MINGW-packages/pull/26470 for details.\n\nSo let's send that option into its well-deserved retirement.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex a464b2009c..cc0ed63af3 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -768,7 +768,6 @@ ifeq ($(uname_S),MINGW)\n \t\tHOST_CPU = aarch64\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n         else\n-\t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n \t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n-- \ngitgitgadget\n\n"},{"id":"549712","messageId":"d67201f9b3ad288373fcbb73fed15356b7a795d8.1785939999.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH 05/12] mingw: avoid over-specifying `--pic-executable`","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:31Z","receivedAt":"2026-08-05T14:26:53Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIn bf2d5d8239e (Don't let ld strip relocations, 2016-01-16) (picked from\nhttps://github.com/git-for-windows/git/pull/612/commits/6a237925bf10),\nGit for Windows introduced the `-Wl,-pic-executable` flag, specifying\nthe exact entry point via `-e`. This required discerning between i686\nand x86_64 code because the former required the symbol to be prefixed\nwith an underscore, the latter did not.\n\nAs per https://sourceware.org/bugzilla/show_bug.cgi?id=10865, the\nspecified symbols are already the default, though.\n\nSo let's drop the overly-specific definition.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex b667c693ec..f6387f4c7b 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -757,15 +757,15 @@ ifeq ($(uname_S),MINGW)\n         ifeq (MINGW32,$(MSYSTEM))\n \t\tprefix = /mingw32\n \t\tHOST_CPU = i686\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup -Wl,--large-address-aware\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable -Wl,--large-address-aware\n         else ifeq (MINGW64,$(MSYSTEM))\n \t\tprefix = /mingw64\n \t\tHOST_CPU = x86_64\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable\n         else ifeq (CLANGARM64,$(MSYSTEM))\n \t\tprefix = /clangarm64\n \t\tHOST_CPU = aarch64\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable\n         else\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n-- \ngitgitgadget\n\n"},{"id":"549715","messageId":"ad96aedda6a2b22b80200a035b714ca111b97cdc.1785939999.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH 04/12] mingw: only use -Wl,--large-address-aware for 32-bit builds","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:30Z","receivedAt":"2026-08-05T14:26:53Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThat option only matters there, and is in fact only really understood in\nthose builds; UCRT64 versions of GCC, for example, do not know what to\ndo with that option.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex cc0ed63af3..b667c693ec 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -757,9 +757,8 @@ ifeq ($(uname_S),MINGW)\n         ifeq (MINGW32,$(MSYSTEM))\n \t\tprefix = /mingw32\n \t\tHOST_CPU = i686\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup\n-        endif\n-        ifeq (MINGW64,$(MSYSTEM))\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup -Wl,--large-address-aware\n+        else ifeq (MINGW64,$(MSYSTEM))\n \t\tprefix = /mingw64\n \t\tHOST_CPU = x86_64\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n@@ -768,7 +767,6 @@ ifeq ($(uname_S),MINGW)\n \t\tHOST_CPU = aarch64\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n         else\n-\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n \t\t-fstack-protector-strong\n-- \ngitgitgadget\n\n"},{"id":"549719","messageId":"1593d1d1a0dceb58640cfa56b49bf30d8a2c6365.1785939999.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:34Z","receivedAt":"2026-08-05T14:26:58Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nMSYS2 defines some helpful environment variables, e.g. `MSYSTEM`. There\nis code in Git for Windows to ensure that that `MSYSTEM` variable is\nset, hard-coding a default.\n\nHowever, the existing solution jumps through hoops to reconstruct the\nproper default, and is even incomplete doing so, as we found out when we\nextended it to support CLANGARM64.\n\nThis is absolutely unnecessary because there is already a perfectly\nvalid `MSYSTEM` value we can use at build time. This is even true when\nbuilding the MINGW32 variant on a MINGW64 system because `makepkg-mingw`\nwill override the `MSYSTEM` value as per the `MINGW_ARCH` array.\n\nThe same is equally true for the `/mingw64`, `/mingw32` and\n`/clangarm64` prefix: those values are already available via the\n`MINGW_PREFIX` environment variable, and we just need to pass that\nsetting through.\n\nOnly when `MINGW_PREFIX` is not set (as is the case in Git for Windows'\nminimal SDK, where only `MSYSTEM` is guaranteed to be set correctly), we\nuse as fall-back the top-level directory whose name is the down-cased\nvalue of the `MSYSTEM` variable.\n\nIncidentally, this also broadens the support to all the configurations\nsupported by the MSYS2 project, i.e. clang64 & ucrt64, too.\n\nNote: This keeps the same, hard-coded MSYSTEM platform support for CMake\nas before, but drops it for Meson (because it is unclear how Meson could\ndo this in a more flexible manner).\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname                    | 14 ++++++--------\n contrib/buildsystems/CMakeLists.txt |  9 ++++++++-\n meson.build                         | 13 ++++++++++++-\n meson_options.txt                   |  4 ++++\n 4 files changed, 30 insertions(+), 10 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 21f53e3f7e..3a90995587 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -465,14 +465,8 @@ ifeq ($(uname_S),Windows)\n \tGIT_VERSION := $(GIT_VERSION).MSVC\n \tpathsep = ;\n \t# Assume that this is built in Git for Windows' SDK\n-        ifeq (MINGW32,$(MSYSTEM))\n-\t\tprefix = /mingw32\n-        else\n-                ifeq (CLANGARM64,$(MSYSTEM))\n-\t\t\tprefix = /clangarm64\n-                else\n-\t\t\tprefix = /mingw64\n-                endif\n+        ifneq (,$(MSYSTEM))\n+\t\tprefix = $(MINGW_PREFIX)\n         endif\n \t# Prepend MSVC 64-bit tool-chain to PATH.\n \t#\n@@ -755,6 +749,10 @@ ifeq ($(uname_S),MINGW)\n \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n         endif\n         ifneq (,$(MSYSTEM))\n+                ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))\n+\t\t\t# Override if empty or does not start with a slash\n+\t\t\tMINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)\n+                endif\n \t\tprefix = $(MINGW_PREFIX)\n \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\ndiff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\nindex a57c4b464f..7285bd9ac2 100644\n--- a/contrib/buildsystems/CMakeLists.txt\n+++ b/contrib/buildsystems/CMakeLists.txt\n@@ -256,7 +256,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n \t\t\t\t_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=\".exe\"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT\n \t\t\t\tNOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0\n \t\t\t\tOVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP\n-\t\t\t\tHAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM)\n+\t\t\t\tHAVE_WPGMPTR HAVE_RTLGENRANDOM)\n+\tif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x64\")\n+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW64\" MINGW_PREFIX=\"mingw64\")\n+\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"arm64\")\n+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"CLANGARM64\" MINGW_PREFIX=\"clangarm64\")\n+\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x86\")\n+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW32\" MINGW_PREFIX=\"mingw32\")\n+\tendif()\n \tlist(APPEND compat_SOURCES\n \t\tcompat/mingw.c\n \t\tcompat/winansi.c\ndiff --git a/meson.build b/meson.build\nindex 7073d5844d..6ddc461873 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1318,7 +1318,6 @@ elif host_machine.system() == 'windows'\n \n   libgit_c_args += [\n     '-DDETECT_MSYS_TTY',\n-    '-DENSURE_MSYSTEM_IS_SET',\n     '-DNATIVE_CRLF',\n     '-DNOGDI',\n     '-DNO_POSIX_GOODIES',\n@@ -1328,6 +1327,18 @@ elif host_machine.system() == 'windows'\n     '-D__USE_MINGW_ANSI_STDIO=0',\n   ]\n \n+  msystem = get_option('msystem')\n+  if msystem != ''\n+    mingw_prefix = get_option('mingw_prefix')\n+    if mingw_prefix == ''\n+      mingw_prefix = '/' + msystem.to_lower()\n+    endif\n+    libgit_c_args += [\n+      '-DENSURE_MSYSTEM_IS_SET=\"' + msystem + '\"',\n+      '-DMINGW_PREFIX=\"' + mingw_prefix + '\"'\n+    ]\n+  endif\n+\n   libgit_dependencies += compiler.find_library('ntdll')\n   libgit_include_directories += 'compat/win32'\n   if compiler.get_id() == 'msvc'\ndiff --git a/meson_options.txt b/meson_options.txt\nindex dc88f130d7..becf4689bf 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -21,6 +21,10 @@ option('runtime_prefix', type: 'boolean', value: false,\n   description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')\n option('sane_tool_path', type: 'array', value: [],\n   description: 'An array of paths to pick up tools from in case the normal tools are broken or lacking.')\n+option('msystem', type: 'string', value: '',\n+  description: 'Fall-back on Windows when MSYSTEM is not set.')\n+option('mingw_prefix', type: 'string', value: '',\n+  description: 'Fall-back on Windows when MINGW_PREFIX is not set.')\n \n # Build information compiled into Git and other parts like documentation.\n option('build_date', type: 'string', value: '',\n-- \ngitgitgadget\n\n"},{"id":"549717","messageId":"b49c42c50d0fdae43224b711ae740097e9343d53.1785939999.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH 06/12] mingw: set the prefix and HOST_CPU as per MSYS2's settings","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:32Z","receivedAt":"2026-08-05T14:26:59Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nMSYS2 already defines a couple of helpful environment variables, and we\ncan use those to infer the installation location as well as the CPU. No\nneed for hard-coding ;-)\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 18 ++++++------------\n 1 file changed, 6 insertions(+), 12 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex f6387f4c7b..8363239513 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -754,19 +754,13 @@ ifeq ($(uname_S),MINGW)\n         ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))\n \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n         endif\n-        ifeq (MINGW32,$(MSYSTEM))\n-\t\tprefix = /mingw32\n-\t\tHOST_CPU = i686\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable -Wl,--large-address-aware\n-        else ifeq (MINGW64,$(MSYSTEM))\n-\t\tprefix = /mingw64\n-\t\tHOST_CPU = x86_64\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-        else ifeq (CLANGARM64,$(MSYSTEM))\n-\t\tprefix = /clangarm64\n-\t\tHOST_CPU = aarch64\n+        ifneq (,$(MSYSTEM))\n+\t\tprefix = $(MINGW_PREFIX)\n+\t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-        else\n+                ifeq (MINGW32,$(MSYSTEM))\n+\t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n+                endif\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n \t\t-fstack-protector-strong\n-- \ngitgitgadget\n\n"},{"id":"549718","messageId":"c4e97449c1065c5d6c4346803ab571eb343ed034.1785939999.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH 09/12] windows: skip linking `git-<command>` for built-ins","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:35Z","receivedAt":"2026-08-05T14:26:59Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIt is merely a historical wart that, say, `git-commit` exists in the\n`libexec/git-core/` directory, a tribute to the original idea to let Git\nbe essentially a bunch of Unix shell scripts revolving around very few\n\"plumbing\" (AKA low-level) commands.\n\nGit has evolved a lot from there. These days, most of Git's\nfunctionality is contained within the `git` executable, in the form of\n\"built-in\" commands.\n\nTo accommodate for scripts that use the \"dashed\" form of Git commands,\neven today, Git provides hard-links that make the `git` executable\navailable as, say, `git-commit`, just in case that an old script has not\nbeen updated to invoke `git commit`.\n\nThose hard-links do not come cheap: they take about half a minute for\nevery build of Git on Windows, they are mistaken for taking up huge\namounts of space by some Windows Explorer versions that do not\nunderstand hard-links, and therefore many a \"bug\" report had to be\naddressed.\n\nThe \"dashed form\" has been officially deprecated in Git version 1.5.4,\nwhich was released on February 2nd, 2008, i.e. a very long time ago.\nThis deprecation was never finalized by skipping these hard-links, but\nwe can start the process now, in Git for Windows.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 3a90995587..88bbe1d78f 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -518,6 +518,7 @@ ifeq ($(uname_S),Windows)\n \tNO_POSIX_GOODIES = UnfortunatelyYes\n \tNATIVE_CRLF = YesPlease\n \tDEFAULT_HELP_FORMAT = html\n+\tSKIP_DASHED_BUILT_INS = YabbaDabbaDoo\n ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n \t# Move system config into top-level /etc/\n \tETC_GITCONFIG = ../etc/gitconfig\n@@ -710,6 +711,7 @@ ifeq ($(uname_S),MINGW)\n \tFSMONITOR_DAEMON_BACKEND = win32\n \tFSMONITOR_OS_SETTINGS = win32\n \n+\tSKIP_DASHED_BUILT_INS = YabbaDabbaDoo\n \tRUNTIME_PREFIX = YesPlease\n \tHAVE_WPGMPTR = YesWeDo\n \tNO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease\n-- \ngitgitgadget\n\n"},{"id":"549720","messageId":"b00d242621ad2da67cd07edf34d3c8d3bb19f638.1785939999.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH 07/12] mingw: only enable the MSYS2-specific stuff when compiling in MSYS2","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:33Z","receivedAt":"2026-08-05T14:26:59Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe tell-tale is the presence of the `MSYSTEM` value while compiling, of\ncourse. In that case, we want to ensure that `MSYSTEM` is set when\nrunning `git.exe`, and also enable the magic MSYS2 tty detection.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 8363239513..21f53e3f7e 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -758,12 +758,12 @@ ifeq ($(uname_S),MINGW)\n \t\tprefix = $(MINGW_PREFIX)\n \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n+\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY\n                 ifeq (MINGW32,$(MSYSTEM))\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                 endif\n         endif\n-\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n-\t\t-fstack-protector-strong\n+\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -fstack-protector-strong\n \tEXTLIBS += -lntdll\n \tEXTRA_PROGRAMS += headless-git$X\n \tINSTALL = /bin/install\n-- \ngitgitgadget\n\n"},{"id":"549716","messageId":"625f01ad2961a8ca9c31048b9128bbce17ee7655.1785939999.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH 10/12] mingw: always define `ETC_*` for MSYS2 environments","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:36Z","receivedAt":"2026-08-05T14:27:01Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nSpecial-casing even more configurations simply does not make sense.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 10 ++++------\n 1 file changed, 4 insertions(+), 6 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 88bbe1d78f..2f7d445eb3 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -519,7 +519,7 @@ ifeq ($(uname_S),Windows)\n \tNATIVE_CRLF = YesPlease\n \tDEFAULT_HELP_FORMAT = html\n \tSKIP_DASHED_BUILT_INS = YabbaDabbaDoo\n-ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n+ifneq (,$(MINGW_PREFIX))\n \t# Move system config into top-level /etc/\n \tETC_GITCONFIG = ../etc/gitconfig\n \tETC_GITATTRIBUTES = ../etc/gitattributes\n@@ -762,6 +762,9 @@ ifeq ($(uname_S),MINGW)\n                 ifeq (MINGW32,$(MSYSTEM))\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                 endif\n+\t\t# Move system config into top-level /etc/\n+\t\tETC_GITCONFIG = ../etc/gitconfig\n+\t\tETC_GITATTRIBUTES = ../etc/gitattributes\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -fstack-protector-strong\n \tEXTLIBS += -lntdll\n@@ -772,11 +775,6 @@ ifeq ($(uname_S),MINGW)\n \tUSE_GETTEXT_SCHEME = fallthrough\n \tUSE_LIBPCRE = YesPlease\n \tNO_PYTHON =\n-        ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n-\t\t# Move system config into top-level /etc/\n-\t\tETC_GITCONFIG = ../etc/gitconfig\n-\t\tETC_GITATTRIBUTES = ../etc/gitattributes\n-        endif\n endif\n ifeq ($(uname_S),QNX)\n \tCOMPAT_CFLAGS += -DSA_RESTART=0\n-- \ngitgitgadget\n\n"},{"id":"549722","messageId":"39a138a773793ad59979a494f11e00ce6c06bbbb.1785939999.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH 11/12] mingw: ensure valid CTYPE","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:37Z","receivedAt":"2026-08-05T14:27:03Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nA change between versions 2.4.1 and 2.6.0 of the MSYS2 runtime modified\nhow Cygwin's runtime (and hence Git for Windows' MSYS2 runtime\nderivative) handles locales: d16a56306d (Consolidate wctomb/mbtowc calls\nfor POSIX-1.2008, 2016-07-20).\n\nAn unintended side-effect is that \"cold-calling\" into the POSIX\nemulation will start with a locale based on the current code page,\nsomething that Git for Windows is very ill-prepared for, as it expects\nto be able to pass a command-line containing non-ASCII characters to the\nshell without having those characters munged.\n\nOne symptom of this behavior: when `git clone` or `git fetch` shell out\nto call `git-upload-pack` with a path that contains non-ASCII\ncharacters, the shell tried to interpret the entire command-line\n(including command-line parameters) as executable path, which obviously\nmust fail.\n\nThis fixes https://github.com/git-for-windows/git/issues/1036\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/mingw.c | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex e0fbd2c66d..afdc1ef2db 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3185,6 +3185,9 @@ static void setup_windows_environment(void)\n \t\tif (!tmp && (tmp = getenv(\"USERPROFILE\")))\n \t\t\tsetenv(\"HOME\", tmp, 1);\n \t}\n+\n+\tif (!getenv(\"LC_ALL\") && !getenv(\"LC_CTYPE\") && !getenv(\"LANG\"))\n+\t\tsetenv(\"LC_CTYPE\", \"C.UTF-8\", 1);\n }\n \n int mingw_platform_has_symlinks(void)\n-- \ngitgitgadget\n\n"},{"id":"549721","messageId":"f822133191c9cca40477fb1bdd5d1416c9fe66c1.1785939999.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH 12/12] mingw: allow `git.exe` to be used instead of the \"Git wrapper\"","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-05T14:26:38Z","receivedAt":"2026-08-05T14:27:04Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nGit for Windows wants to add `git.exe` to the users' `PATH`, without\ncluttering the latter with unnecessary executables such as `wish.exe`.\nTo that end, it invented the concept of its \"Git wrapper\", i.e. a tiny\nexecutable located in `C:\\Program Files\\Git\\cmd\\git.exe` (originally a\nCMD script) whose sole purpose is to set up a couple of environment\nvariables and then spawn the _actual_ `git.exe` (which nowadays lives in\n`C:\\Program Files\\Git\\mingw64\\bin\\git.exe` for 64-bit, and the obvious\nequivalent for 32-bit installations).\n\nCurrently, the following environment variables are set unless already\ninitialized:\n\n- `MSYSTEM`, to make sure that the MSYS2 Bash and the MSYS2 Perl\n  interpreter behave as expected, and\n\n- `PLINK_PROTOCOL`, to force PuTTY's `plink.exe` to use the SSH\n  protocol instead of Telnet,\n\n- `PATH`, to make sure that the `bin` folder in the user's home\n  directory, as well as the `/mingw64/bin` and the `/usr/bin`\n  directories are included. The trick here is that the `/mingw64/bin/`\n  and `/usr/bin/` directories are relative to the top-level installation\n  directory of Git for Windows (which the included Bash interprets as\n  `/`, i.e. as the MSYS pseudo root directory).\n\nUsing the absence of `MSYSTEM` as a tell-tale, we can detect in\n`git.exe` whether these environment variables have been initialized\nproperly. Therefore we can call `C:\\Program Files\\Git\\mingw64\\bin\\git`\nin-place after this change, without having to call Git through the Git\nwrapper.\n\nObviously, above-mentioned directories must be _prepended_ to the `PATH`\nvariable, otherwise we risk picking up executables from unrelated Git\ninstallations. We do that by constructing the new `PATH` value from\nscratch, appending `$HOME/bin` (if `HOME` is set), then the MSYS2 system\ndirectories, and then appending the original `PATH`.\n\nSide note: this modification of the `PATH` variable is independent of\nthe modification necessary to reach the executables and scripts in\n`/mingw64/libexec/git-core/`, i.e. the `GIT_EXEC_PATH`. That\nmodification is still performed by Git, elsewhere, long after making the\nchanges described above.\n\nWhile we _still_ cannot simply hard-link `mingw64\\bin\\git.exe` to `cmd`\n(because the former depends on a couple of `.dll` files that are only in\n`mingw64\\bin`, i.e. calling `...\\cmd\\git.exe` would fail to load due to\nmissing dependencies), at least we can now avoid that extra process of\nrunning the Git wrapper (which then has to wait for the spawned\n`git.exe` to finish) by calling `...\\mingw64\\bin\\git.exe` directly, via\nits absolute path.\n\nTesting this is in Git's test suite tricky: we set up a \"new\" MSYS\npseudo-root and copy the `git.exe` file into the appropriate location,\nthen verify that `MSYSTEM` is set properly, and also that the `PATH` is\nmodified so that scripts can be found in `$HOME/bin`, `/mingw64/bin/`\nand `/usr/bin/`.\n\nThis addresses https://github.com/git-for-windows/git/issues/2283\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/mingw.c        | 65 +++++++++++++++++++++++++++++++++++++++++++\n config.mak.uname      |  8 ++++--\n t/t0060-path-utils.sh | 33 +++++++++++++++++++++-\n 3 files changed, 103 insertions(+), 3 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex afdc1ef2db..563e6299bc 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3134,6 +3134,45 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)\n \treturn -1;\n }\n \n+#ifdef ENSURE_MSYSTEM_IS_SET\n+#if !defined(RUNTIME_PREFIX) || !defined(HAVE_WPGMPTR) || !defined(MINGW_PREFIX)\n+static size_t append_system_bin_dirs(char *path UNUSED, size_t size UNUSED)\n+{\n+\treturn 0;\n+}\n+#else\n+static size_t append_system_bin_dirs(char *path, size_t size)\n+{\n+\tchar prefix[32768];\n+\tconst char *slash;\n+\tsize_t len = xwcstoutf(prefix, _wpgmptr, sizeof(prefix)), off = 0;\n+\n+\tif (len == 0 || len >= sizeof(prefix) ||\n+\t    !(slash = find_last_dir_sep(prefix)))\n+\t\treturn 0;\n+\t/* strip trailing `git.exe` */\n+\tlen = slash - prefix;\n+\n+\t/* strip trailing `cmd` or `<mingw-prefix>\\bin` or `bin` or `libexec\\git-core` */\n+\tif (strip_suffix_mem(prefix, &len, \"\\\\\" MINGW_PREFIX \"\\\\libexec\\\\git-core\") ||\n+\t    strip_suffix_mem(prefix, &len, \"\\\\\" MINGW_PREFIX \"\\\\bin\"))\n+\t\toff += xsnprintf(path + off, size - off,\n+\t\t\t\t \"%.*s\\\\\" MINGW_PREFIX \"\\\\bin;\", (int)len, prefix);\n+\telse if (strip_suffix_mem(prefix, &len, \"\\\\cmd\") ||\n+\t\t strip_suffix_mem(prefix, &len, \"\\\\bin\") ||\n+\t\t strip_suffix_mem(prefix, &len, \"\\\\libexec\\\\git-core\"))\n+\t\toff += xsnprintf(path + off, size - off,\n+\t\t\t\t \"%.*s\\\\\" MINGW_PREFIX \"\\\\bin;\", (int)len, prefix);\n+\telse\n+\t\treturn 0;\n+\n+\toff += xsnprintf(path + off, size - off,\n+\t\t\t \"%.*s\\\\usr\\\\bin;\", (int)len, prefix);\n+\treturn off;\n+}\n+#endif\n+#endif\n+\n static void setup_windows_environment(void)\n {\n \tchar *tmp = getenv(\"TMPDIR\");\n@@ -3186,6 +3225,32 @@ static void setup_windows_environment(void)\n \t\t\tsetenv(\"HOME\", tmp, 1);\n \t}\n \n+\tif (!getenv(\"PLINK_PROTOCOL\"))\n+\t\tsetenv(\"PLINK_PROTOCOL\", \"ssh\", 0);\n+\n+#ifdef ENSURE_MSYSTEM_IS_SET\n+\tif (!(tmp = getenv(\"MSYSTEM\")) || !tmp[0]) {\n+\t\tconst char *home = getenv(\"HOME\"), *path = getenv(\"PATH\");\n+\t\tchar buf[32768];\n+\t\tsize_t off = 0;\n+\n+\t\tsetenv(\"MSYSTEM\", ENSURE_MSYSTEM_IS_SET, 1);\n+\n+\t\tif (home)\n+\t\t\toff += xsnprintf(buf + off, sizeof(buf) - off,\n+\t\t\t\t\t \"%s\\\\bin;\", home);\n+\t\toff += append_system_bin_dirs(buf + off, sizeof(buf) - off);\n+\t\tif (path)\n+\t\t\toff += xsnprintf(buf + off, sizeof(buf) - off,\n+\t\t\t\t\t \"%s\", path);\n+\t\telse if (off > 0)\n+\t\t\tbuf[off - 1] = '\\0';\n+\t\telse\n+\t\t\tbuf[0] = '\\0';\n+\t\tsetenv(\"PATH\", buf, 1);\n+\t}\n+#endif\n+\n \tif (!getenv(\"LC_ALL\") && !getenv(\"LC_CTYPE\") && !getenv(\"LANG\"))\n \t\tsetenv(\"LC_CTYPE\", \"C.UTF-8\", 1);\n }\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 2f7d445eb3..0b63be10b7 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -535,7 +535,9 @@ endif\n \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n \t\tcompat/win32/trace2_win32_process_info.o \\\n \t\tcompat/win32/dirent.o\n-\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n+\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY \\\n+\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" -DMINGW_PREFIX=\"\\\"$(patsubst /%,%,$(MINGW_PREFIX))\\\"\" \\\n+\t\t-DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n \tBASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE\n \t# invalidcontinue.obj allows Git's source code to close the same file\n \t# handle twice, or to access the osfhandle of an already-closed stdout\n@@ -758,7 +760,9 @@ ifeq ($(uname_S),MINGW)\n \t\tprefix = $(MINGW_PREFIX)\n \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY\n+\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY \\\n+\t\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" \\\n+\t\t\t-DMINGW_PREFIX=\"\\\"$(patsubst /%,%,$(MINGW_PREFIX))\\\"\"\n                 ifeq (MINGW32,$(MSYSTEM))\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                 endif\ndiff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh\nindex 8545cdfab5..56faf5fe73 100755\n--- a/t/t0060-path-utils.sh\n+++ b/t/t0060-path-utils.sh\n@@ -602,7 +602,8 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'RUNTIME_PREFIX wor\n \techo \"echo HERE\" | write_script pretend/libexec/git-core/git-here &&\n \tGIT_EXEC_PATH= ./pretend/bin/git here >actual &&\n \techo HERE >expect &&\n-\ttest_cmp expect actual'\n+\ttest_cmp expect actual\n+'\n \n test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works' '\n \tgit config yes.path \"%(prefix)/yes\" &&\n@@ -611,4 +612,34 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works'\n \ttest_cmp expect actual\n '\n \n+test_expect_success MINGW,RUNTIME_PREFIX 'MSYSTEM/PATH is adjusted if necessary' '\n+\tif test -z \"$MINGW_PREFIX\"\n+\tthen\n+\t\tMINGW_PREFIX=\"/$(echo \"${MSYSTEM:-MINGW64}\" | tr A-Z a-z)\"\n+\tfi &&\n+\tmkdir -p \"$HOME\"/bin pretend\"$MINGW_PREFIX\"/bin \\\n+\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core pretend/usr/bin &&\n+\tcp \"$GIT_EXEC_PATH\"/git.exe pretend\"$MINGW_PREFIX\"/bin/ &&\n+\tcp \"$GIT_EXEC_PATH\"/git.exe pretend\"$MINGW_PREFIX\"/libexec/git-core/ &&\n+\t# copy the .dll files, if any (happens when building via CMake)\n+\tif test -n \"$(ls \"$GIT_EXEC_PATH\"/*.dll 2>/dev/null)\"\n+\tthen\n+\t\tcp \"$GIT_EXEC_PATH\"/*.dll pretend\"$MINGW_PREFIX\"/bin/ &&\n+\t\tcp \"$GIT_EXEC_PATH\"/*.dll pretend\"$MINGW_PREFIX\"/libexec/git-core/\n+\tfi &&\n+\techo \"env | grep MSYSTEM=\" | write_script \"$HOME\"/bin/git-test-home &&\n+\techo \"echo ${MINGW_PREFIX#/}\" | write_script pretend\"$MINGW_PREFIX\"/bin/git-test-bin &&\n+\techo \"echo usr\" | write_script pretend/usr/bin/git-test-bin2 &&\n+\n+\t(\n+\t\tMSYSTEM= &&\n+\t\tGIT_EXEC_PATH= &&\n+\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core/git.exe test-home >actual &&\n+\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core/git.exe test-bin >>actual &&\n+\t\tpretend\"$MINGW_PREFIX\"/bin/git.exe test-bin2 >>actual\n+\t) &&\n+\ttest_write_lines MSYSTEM=$MSYSTEM \"${MINGW_PREFIX#/}\" usr >expect &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\n-- \ngitgitgadget\n"},{"id":"549750","messageId":"xmqqik5oqyon.fsf@gitster.g","threadId":"66125","inReplyTo":"c4e97449c1065c5d6c4346803ab571eb343ed034.1785939999.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 09/12] windows: skip linking `git-<command>` for built-ins","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-08-05T17:12:08Z","receivedAt":"2026-08-05T17:12:10Z","isPatch":true,"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> The \"dashed form\" has been officially deprecated in Git version 1.5.4,\n> which was released on February 2nd, 2008, i.e. a very long time ago.\n> This deprecation was never finalized by skipping these hard-links, but\n> we can start the process now, in Git for Windows.\n\nGood.  Perhaps somebody (you do not have to volunteer) can champion\ntheir removal from everywhere at Git 3.0 version boundary?\n\nThanks.\n"},{"id":"549751","messageId":"xmqq7bm4qxv6.fsf@gitster.g","threadId":"66125","inReplyTo":"1593d1d1a0dceb58640cfa56b49bf30d8a2c6365.1785939999.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-08-05T17:29:49Z","receivedAt":"2026-08-05T17:29:51Z","isPatch":true,"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> -                ifeq (CLANGARM64,$(MSYSTEM))\n> -\t\t\tprefix = /clangarm64\n> -                else\n> -\t\t\tprefix = /mingw64\n> -                endif\n> +        ifneq (,$(MSYSTEM))\n> +\t\tprefix = $(MINGW_PREFIX)\n>          endif\n\nMental note: if $(MSYSTEM) is not an empty string, we set prefix to\n$(MINGW_PREFIX).\n\n> @@ -755,6 +749,10 @@ ifeq ($(uname_S),MINGW)\n>  \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n>          endif\n>          ifneq (,$(MSYSTEM))\n> +                ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))\n> +\t\t\t# Override if empty or does not start with a slash\n> +\t\t\tMINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)\n> +                endif\n\nMental note: MINGW_PREFIX that does not begin with a slash is forced\nto begin with a slash.\n\n>  \t\tprefix = $(MINGW_PREFIX)\n\nAnd that becomes $(prefix).\n\n> diff --git a/meson.build b/meson.build\n> index 7073d5844d..6ddc461873 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -1318,7 +1318,6 @@ elif host_machine.system() == 'windows'\n>  \n>    libgit_c_args += [\n>      '-DDETECT_MSYS_TTY',\n> -    '-DENSURE_MSYSTEM_IS_SET',\n>      '-DNATIVE_CRLF',\n>      '-DNOGDI',\n>      '-DNO_POSIX_GOODIES',\n> @@ -1328,6 +1327,18 @@ elif host_machine.system() == 'windows'\n>      '-D__USE_MINGW_ANSI_STDIO=0',\n>    ]\n>  \n> +  msystem = get_option('msystem')\n> +  if msystem != ''\n> +    mingw_prefix = get_option('mingw_prefix')\n> +    if mingw_prefix == ''\n> +      mingw_prefix = '/' + msystem.to_lower()\n> +    endif\n> +    libgit_c_args += [\n> +      '-DENSURE_MSYSTEM_IS_SET=\"' + msystem + '\"',\n> +      '-DMINGW_PREFIX=\"' + mingw_prefix + '\"'\n> +    ]\n> +  endif\n\nLowercase mingw_prefix in Meson world corresponds to MINGW_PREFIX in\nMake world, I guess.  -DMINGW_PRFIX gets mingw_prefix which begins\nwith a slash.\n\nI do not do Windows or Meson, but doesn't this contradict with what\nwe have in [12/12], part of which says:\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 2f7d445eb3..0b63be10b7 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -535,7 +535,9 @@ endif\n \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n \t\tcompat/win32/trace2_win32_process_info.o \\\n \t\tcompat/win32/dirent.o\n-\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n+\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY \\\n+\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" -DMINGW_PREFIX=\"\\\"$(patsubst /%,%,$(MINGW_PREFIX))\\\"\" \\\n+\t\t-DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n \tBASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE\n \t# invalidcontinue.obj allows Git's source code to close the same file\n \t# handle twice, or to access the osfhandle of an already-closed stdout\n\n\nIOW, -DMINGW_PREFIX passed to the compiler strips leading slash from\n$(MINGW_PREFIX).\n\nIsn't it necessary to strip the leading slash from ming_prefix also\non the Meson side?\n"},{"id":"549851","messageId":"9f905100-003b-8ef2-3e2e-2f9ed57dda1b@gmx.de","threadId":"66125","inReplyTo":"xmqq7bm4qxv6.fsf@gitster.g","subject":"Re: [PATCH 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2026-08-06T12:50:44Z","receivedAt":"2026-08-06T12:50:51Z","isPatch":true,"body":"Hi Junio,\n\nOn Wed, 5 Aug 2026, Junio C Hamano wrote:\n\n> \"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\n> writes:\n> [...]\n> > diff --git a/meson.build b/meson.build\n> > index 7073d5844d..6ddc461873 100644\n> > --- a/meson.build\n> > +++ b/meson.build\n> > @@ -1318,7 +1318,6 @@ elif host_machine.system() == 'windows'\n> >  \n> >    libgit_c_args += [\n> >      '-DDETECT_MSYS_TTY',\n> > -    '-DENSURE_MSYSTEM_IS_SET',\n> >      '-DNATIVE_CRLF',\n> >      '-DNOGDI',\n> >      '-DNO_POSIX_GOODIES',\n> > @@ -1328,6 +1327,18 @@ elif host_machine.system() == 'windows'\n> >      '-D__USE_MINGW_ANSI_STDIO=0',\n> >    ]\n> >  \n> > +  msystem = get_option('msystem')\n> > +  if msystem != ''\n> > +    mingw_prefix = get_option('mingw_prefix')\n> > +    if mingw_prefix == ''\n> > +      mingw_prefix = '/' + msystem.to_lower()\n> > +    endif\n> > +    libgit_c_args += [\n> > +      '-DENSURE_MSYSTEM_IS_SET=\"' + msystem + '\"',\n> > +      '-DMINGW_PREFIX=\"' + mingw_prefix + '\"'\n> > +    ]\n> > +  endif\n> \n> Lowercase mingw_prefix in Meson world corresponds to MINGW_PREFIX in\n> Make world, I guess.  -DMINGW_PRFIX gets mingw_prefix which begins\n> with a slash.\n> \n> I do not do Windows or Meson, but doesn't this contradict with what\n> we have in [12/12], part of which says:\n> \n> diff --git a/config.mak.uname b/config.mak.uname\n> index 2f7d445eb3..0b63be10b7 100644\n> --- a/config.mak.uname\n> +++ b/config.mak.uname\n> @@ -535,7 +535,9 @@ endif\n>  \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n>  \t\tcompat/win32/trace2_win32_process_info.o \\\n>  \t\tcompat/win32/dirent.o\n> -\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n> +\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY \\\n> +\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" -DMINGW_PREFIX=\"\\\"$(patsubst /%,%,$(MINGW_PREFIX))\\\"\" \\\n> +\t\t-DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n>  \tBASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE\n>  \t# invalidcontinue.obj allows Git's source code to close the same file\n>  \t# handle twice, or to access the osfhandle of an already-closed stdout\n> \n> \n> IOW, -DMINGW_PREFIX passed to the compiler strips leading slash from\n> $(MINGW_PREFIX).\n> \n> Isn't it necessary to strip the leading slash from ming_prefix also\n> on the Meson side?\n\nCorrect. Since Git for Windows does not use Meson to build the project,\nand since the Visual C-based builds (including CI's `windows-meson-build`)\ndo not use `MSYSTEM`, this was not caught earlier. The next iteration will\nhave the fix.\n\nCiao,\nJohannes\n"},{"id":"549869","messageId":"xmqq33wrkvmu.fsf@gitster.g","threadId":"66125","inReplyTo":"f822133191c9cca40477fb1bdd5d1416c9fe66c1.1785939999.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 12/12] mingw: allow `git.exe` to be used instead of the \"Git wrapper\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-08-06T17:26:49Z","receivedAt":"2026-08-06T17:26:51Z","isPatch":true,"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> @@ -3186,6 +3225,32 @@ static void setup_windows_environment(void)\n>  \t\t\tsetenv(\"HOME\", tmp, 1);\n>  \t}\n>  \n> +\tif (!getenv(\"PLINK_PROTOCOL\"))\n> +\t\tsetenv(\"PLINK_PROTOCOL\", \"ssh\", 0);\n> +\n> +#ifdef ENSURE_MSYSTEM_IS_SET\n> +\tif (!(tmp = getenv(\"MSYSTEM\")) || !tmp[0]) {\n\nChecking tmp[0] is a sign that we do not consider MSYSTEM set to an\nempty string a sane state and ENSURE_MSYSTEM_IS_SET is about\ncorrecting it, right?\n\n> +\t\tconst char *home = getenv(\"HOME\"), *path = getenv(\"PATH\");\n> +\t\tchar buf[32768];\n> +\t\tsize_t off = 0;\n> +\n> +\t\tsetenv(\"MSYSTEM\", ENSURE_MSYSTEM_IS_SET, 1);\n\nIn config.mak.uname, ENSURE_MSYSTEM_IS_SET is defined to \"$(MSYSTEM)\".\n\n+\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY \\\n+\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" -DMINGW_PREFIX=\"\\\"$(patsubst /%,%,$(MINGW_PREFIX))\\\"\" \\\n\nCan $(MSYSTEM) be an empty string or undefined at the build time,\nmaking ENSURE_MSYSTEM_IS_SET set to \"\" (two double-quotes)?  Which\nwould mean we are exporting MSYSTEM defined to be an empty string as\nwell with this setenv.\n\nIt seems ifeq($(uname_S),MINGW) side protects against this situation\nby placing the cflags definition\n\t\n+\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY \\\n+\t\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" \\\n\ninside \"ifneq (,$(MSYSTEM))..endif\".  That way, ENSURE_MSYSTEM_IS_SET\nis not defined to \"\" (two double-quotes), so #ifdef ENSURE_MSYSTEM_IS_SET\nwould not kick in.\n\n"},{"id":"550352","messageId":"bacfe6f4-706e-670c-3466-ccb4d7caeffb@gmx.de","threadId":"66125","inReplyTo":"xmqq33wrkvmu.fsf@gitster.g","subject":"Re: [PATCH 12/12] mingw: allow `git.exe` to be used instead of the \"Git wrapper\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2026-08-12T07:51:21Z","receivedAt":"2026-08-12T07:51:25Z","isPatch":true,"body":"Hi Junio,\n\nOn Thu, 6 Aug 2026, Junio C Hamano wrote:\n\n> \"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\n> writes:\n> \n> > @@ -3186,6 +3225,32 @@ static void setup_windows_environment(void)\n> >  \t\t\tsetenv(\"HOME\", tmp, 1);\n> >  \t}\n> >  \n> > +\tif (!getenv(\"PLINK_PROTOCOL\"))\n> > +\t\tsetenv(\"PLINK_PROTOCOL\", \"ssh\", 0);\n> > +\n> > +#ifdef ENSURE_MSYSTEM_IS_SET\n> > +\tif (!(tmp = getenv(\"MSYSTEM\")) || !tmp[0]) {\n> \n> Checking tmp[0] is a sign that we do not consider MSYSTEM set to an\n> empty string a sane state and ENSURE_MSYSTEM_IS_SET is about\n> correcting it, right?\n\n\"sane state\" is quite the strong wording for such a minor issue.\n\nThe MSYSTEM variable is useful as an indicator, and is therefore used in\nmany scripts. Git itself only uses it as a tell-tale that a GUI should be\nused in `git bisect visualize`, otherwise Git is totally fine with empty\nor even non-sensical values.\n\nBut it _is_ a convenient thing to have, together with `MINGW_PREFIX` to\nensure that the respective `/*/bin/` directories are prepended to the\n`PATH` variable. That's what this is all about.\n\n> \n> > +\t\tconst char *home = getenv(\"HOME\"), *path = getenv(\"PATH\");\n> > +\t\tchar buf[32768];\n> > +\t\tsize_t off = 0;\n> > +\n> > +\t\tsetenv(\"MSYSTEM\", ENSURE_MSYSTEM_IS_SET, 1);\n> \n> In config.mak.uname, ENSURE_MSYSTEM_IS_SET is defined to \"$(MSYSTEM)\".\n> \n> +\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY \\\n> +\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" -DMINGW_PREFIX=\"\\\"$(patsubst /%,%,$(MINGW_PREFIX))\\\"\" \\\n> \n> Can $(MSYSTEM) be an empty string or undefined at the build time,\n> making ENSURE_MSYSTEM_IS_SET set to \"\" (two double-quotes)?\n\nSure it can. Just like `PATH` or `HOME` can be empty, or invalid. But the\nperson building the project has to go out of their way to make it so,\ntherefore I don't want to spend any more brain cells on that highly\nunlikely scenario.\n\nCiao,\nJohannes\n\n> Which would mean we are exporting MSYSTEM defined to be an empty string\n> as well with this setenv.\n> \n> It seems ifeq($(uname_S),MINGW) side protects against this situation\n> by placing the cflags definition\n> \t\n> +\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY \\\n> +\t\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" \\\n> \n> inside \"ifneq (,$(MSYSTEM))..endif\".  That way, ENSURE_MSYSTEM_IS_SET\n> is not defined to \"\" (two double-quotes), so #ifdef ENSURE_MSYSTEM_IS_SET\n> would not kick in.\n> \n> \n"},{"id":"550353","messageId":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH v2 00/12] Upstream some more Git for Windows' patches","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:40Z","receivedAt":"2026-08-12T07:52:55Z","isPatch":true,"body":"When rebasing a Git for Windows commit to enable Rust in Windows CI, I\nnoticed just how many of the preceding commits touching adjacent code\nhaven't been upstreamed yet. This patch series rectifies that.\n\nChanges since v1:\n\n * Fixed the meson-side handling of the MINGW_PREFIX constant (this was not\n   noticed in the Git for Windows project because it does not use Meson to\n   build the project).\n\nJohannes Schindelin (12):\n  mingw: include the Python parts in the build\n  mingw: stop hard-coding `CC = gcc`\n  mingw: drop the -D_USE_32BIT_TIME_T option\n  mingw: only use -Wl,--large-address-aware for 32-bit builds\n  mingw: avoid over-specifying `--pic-executable`\n  mingw: set the prefix and HOST_CPU as per MSYS2's settings\n  mingw: only enable the MSYS2-specific stuff when compiling in MSYS2\n  mingw: rely on MSYS2's metadata instead of hard-coding it\n  windows: skip linking `git-<command>` for built-ins\n  mingw: always define `ETC_*` for MSYS2 environments\n  mingw: ensure valid CTYPE\n  mingw: allow `git.exe` to be used instead of the \"Git wrapper\"\n\n compat/mingw.c                      | 68 +++++++++++++++++++++++++++++\n config.mak.uname                    | 61 ++++++++++++--------------\n contrib/buildsystems/CMakeLists.txt |  9 +++-\n meson.build                         | 15 ++++++-\n meson_options.txt                   |  4 ++\n t/t0060-path-utils.sh               | 33 +++++++++++++-\n 6 files changed, 153 insertions(+), 37 deletions(-)\n\n\nbase-commit: 5b2471720c93ee30e5764a19f3d3b3ae9ec9712a\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2195%2Fdscho%2Fupstream-some-more-git-for-windows-patches-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2195/dscho/upstream-some-more-git-for-windows-patches-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/2195\n\nRange-diff vs v1:\n\n  1:  fd594ffa6c =  1:  fd594ffa6c mingw: include the Python parts in the build\n  2:  47fc974582 =  2:  47fc974582 mingw: stop hard-coding `CC = gcc`\n  3:  53f1fd5763 =  3:  53f1fd5763 mingw: drop the -D_USE_32BIT_TIME_T option\n  4:  ad96aedda6 =  4:  ad96aedda6 mingw: only use -Wl,--large-address-aware for 32-bit builds\n  5:  d67201f9b3 =  5:  d67201f9b3 mingw: avoid over-specifying `--pic-executable`\n  6:  b49c42c50d =  6:  b49c42c50d mingw: set the prefix and HOST_CPU as per MSYS2's settings\n  7:  b00d242621 =  7:  b00d242621 mingw: only enable the MSYS2-specific stuff when compiling in MSYS2\n  8:  1593d1d1a0 !  8:  9de4ea7fc1 mingw: rely on MSYS2's metadata instead of hard-coding it\n     @@ Commit message\n          as before, but drops it for Meson (because it is unclear how Meson could\n          do this in a more flexible manner).\n      \n     +    Helped-by: Junio C Hamano <gitster@pobox.com>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## config.mak.uname ##\n     @@ meson.build: elif host_machine.system() == 'windows'\n      +  if msystem != ''\n      +    mingw_prefix = get_option('mingw_prefix')\n      +    if mingw_prefix == ''\n     -+      mingw_prefix = '/' + msystem.to_lower()\n     ++      mingw_prefix = msystem.to_lower()\n     ++    elif mingw_prefix.startswith('/')\n     ++      mingw_prefix = mingw_prefix.substring(1)\n      +    endif\n      +    libgit_c_args += [\n      +      '-DENSURE_MSYSTEM_IS_SET=\"' + msystem + '\"',\n  9:  c4e97449c1 =  9:  60a2999b75 windows: skip linking `git-<command>` for built-ins\n 10:  625f01ad29 = 10:  1dd6ac9295 mingw: always define `ETC_*` for MSYS2 environments\n 11:  39a138a773 = 11:  d44d05c897 mingw: ensure valid CTYPE\n 12:  f822133191 = 12:  679d1fdd41 mingw: allow `git.exe` to be used instead of the \"Git wrapper\"\n\n-- \ngitgitgadget\n"},{"id":"550354","messageId":"fd594ffa6cfacaf7896ab312d51d39f30d09be81.1786521173.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"[PATCH v2 01/12] mingw: include the Python parts in the build","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:41Z","receivedAt":"2026-08-12T07:52:57Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWhile Git for Windows does not _ship_ Python (in order to save on\nbandwidth), MSYS2 provides very fine Python interpreters that users can\neasily take advantage of, by using Git for Windows within its SDK.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 9ebd240378..8dd8acfaa5 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -781,6 +781,7 @@ ifeq ($(uname_S),MINGW)\n \tHAVE_LIBCHARSET_H = YesPlease\n \tUSE_GETTEXT_SCHEME = fallthrough\n \tUSE_LIBPCRE = YesPlease\n+\tNO_PYTHON =\n         ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n \t\t# Move system config into top-level /etc/\n \t\tETC_GITCONFIG = ../etc/gitconfig\n-- \ngitgitgadget\n\n"},{"id":"550356","messageId":"47fc97458247529f9d2205cd7c0bdf5125ad8832.1786521173.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"[PATCH v2 02/12] mingw: stop hard-coding `CC = gcc`","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:42Z","receivedAt":"2026-08-12T07:52:59Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThis is no longer true in general, not with supporting Clang out of the\nbox.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 8dd8acfaa5..a464b2009c 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -771,7 +771,6 @@ ifeq ($(uname_S),MINGW)\n \t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n \t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n         endif\n-\tCC = gcc\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n \t\t-fstack-protector-strong\n \tEXTLIBS += -lntdll\n-- \ngitgitgadget\n\n"},{"id":"550355","messageId":"53f1fd576379a7331e827a2384605a1445f85d86.1786521173.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"[PATCH v2 03/12] mingw: drop the -D_USE_32BIT_TIME_T option","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:43Z","receivedAt":"2026-08-12T07:53:01Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThis option was added in fa93bb20d72 (MinGW: Fix stat definitions to\nwork with MinGW runtime version 4.0, 2013-09-11), i.e. a _long_ time\nago. So long, in fact, that it still targeted MinGW. But we switched to\nmingw-w64 in 2015, which seems not to share the problem, and therefore\ndoes not require a fix.\n\nEven worse: This flag is incompatible with UCRT64, which we are about to\nsupport by way of upstreaming `mingw-w64-git` to the MSYS2 project, see\nhttps://github.com/msys2/MINGW-packages/pull/26470 for details.\n\nSo let's send that option into its well-deserved retirement.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex a464b2009c..cc0ed63af3 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -768,7 +768,6 @@ ifeq ($(uname_S),MINGW)\n \t\tHOST_CPU = aarch64\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n         else\n-\t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n \t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n-- \ngitgitgadget\n\n"},{"id":"550357","messageId":"ad96aedda6a2b22b80200a035b714ca111b97cdc.1786521173.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"[PATCH v2 04/12] mingw: only use -Wl,--large-address-aware for 32-bit builds","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:44Z","receivedAt":"2026-08-12T07:53:03Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThat option only matters there, and is in fact only really understood in\nthose builds; UCRT64 versions of GCC, for example, do not know what to\ndo with that option.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex cc0ed63af3..b667c693ec 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -757,9 +757,8 @@ ifeq ($(uname_S),MINGW)\n         ifeq (MINGW32,$(MSYSTEM))\n \t\tprefix = /mingw32\n \t\tHOST_CPU = i686\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup\n-        endif\n-        ifeq (MINGW64,$(MSYSTEM))\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup -Wl,--large-address-aware\n+        else ifeq (MINGW64,$(MSYSTEM))\n \t\tprefix = /mingw64\n \t\tHOST_CPU = x86_64\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n@@ -768,7 +767,6 @@ ifeq ($(uname_S),MINGW)\n \t\tHOST_CPU = aarch64\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n         else\n-\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n \t\t-fstack-protector-strong\n-- \ngitgitgadget\n\n"},{"id":"550358","messageId":"d67201f9b3ad288373fcbb73fed15356b7a795d8.1786521173.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"[PATCH v2 05/12] mingw: avoid over-specifying `--pic-executable`","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:45Z","receivedAt":"2026-08-12T07:53:05Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIn bf2d5d8239e (Don't let ld strip relocations, 2016-01-16) (picked from\nhttps://github.com/git-for-windows/git/pull/612/commits/6a237925bf10),\nGit for Windows introduced the `-Wl,-pic-executable` flag, specifying\nthe exact entry point via `-e`. This required discerning between i686\nand x86_64 code because the former required the symbol to be prefixed\nwith an underscore, the latter did not.\n\nAs per https://sourceware.org/bugzilla/show_bug.cgi?id=10865, the\nspecified symbols are already the default, though.\n\nSo let's drop the overly-specific definition.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex b667c693ec..f6387f4c7b 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -757,15 +757,15 @@ ifeq ($(uname_S),MINGW)\n         ifeq (MINGW32,$(MSYSTEM))\n \t\tprefix = /mingw32\n \t\tHOST_CPU = i686\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup -Wl,--large-address-aware\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable -Wl,--large-address-aware\n         else ifeq (MINGW64,$(MSYSTEM))\n \t\tprefix = /mingw64\n \t\tHOST_CPU = x86_64\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable\n         else ifeq (CLANGARM64,$(MSYSTEM))\n \t\tprefix = /clangarm64\n \t\tHOST_CPU = aarch64\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable\n         else\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n-- \ngitgitgadget\n\n"},{"id":"550359","messageId":"b49c42c50d0fdae43224b711ae740097e9343d53.1786521173.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"[PATCH v2 06/12] mingw: set the prefix and HOST_CPU as per MSYS2's settings","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:46Z","receivedAt":"2026-08-12T07:53:06Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nMSYS2 already defines a couple of helpful environment variables, and we\ncan use those to infer the installation location as well as the CPU. No\nneed for hard-coding ;-)\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 18 ++++++------------\n 1 file changed, 6 insertions(+), 12 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex f6387f4c7b..8363239513 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -754,19 +754,13 @@ ifeq ($(uname_S),MINGW)\n         ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))\n \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n         endif\n-        ifeq (MINGW32,$(MSYSTEM))\n-\t\tprefix = /mingw32\n-\t\tHOST_CPU = i686\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable -Wl,--large-address-aware\n-        else ifeq (MINGW64,$(MSYSTEM))\n-\t\tprefix = /mingw64\n-\t\tHOST_CPU = x86_64\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-        else ifeq (CLANGARM64,$(MSYSTEM))\n-\t\tprefix = /clangarm64\n-\t\tHOST_CPU = aarch64\n+        ifneq (,$(MSYSTEM))\n+\t\tprefix = $(MINGW_PREFIX)\n+\t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-        else\n+                ifeq (MINGW32,$(MSYSTEM))\n+\t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n+                endif\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n \t\t-fstack-protector-strong\n-- \ngitgitgadget\n\n"},{"id":"550360","messageId":"b00d242621ad2da67cd07edf34d3c8d3bb19f638.1786521173.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"[PATCH v2 07/12] mingw: only enable the MSYS2-specific stuff when compiling in MSYS2","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:47Z","receivedAt":"2026-08-12T07:53:07Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe tell-tale is the presence of the `MSYSTEM` value while compiling, of\ncourse. In that case, we want to ensure that `MSYSTEM` is set when\nrunning `git.exe`, and also enable the magic MSYS2 tty detection.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 8363239513..21f53e3f7e 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -758,12 +758,12 @@ ifeq ($(uname_S),MINGW)\n \t\tprefix = $(MINGW_PREFIX)\n \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n+\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY\n                 ifeq (MINGW32,$(MSYSTEM))\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                 endif\n         endif\n-\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n-\t\t-fstack-protector-strong\n+\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -fstack-protector-strong\n \tEXTLIBS += -lntdll\n \tEXTRA_PROGRAMS += headless-git$X\n \tINSTALL = /bin/install\n-- \ngitgitgadget\n\n"},{"id":"550361","messageId":"9de4ea7fc1d250e8e9dfae386424451242cb3daa.1786521173.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"[PATCH v2 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:48Z","receivedAt":"2026-08-12T07:53:08Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nMSYS2 defines some helpful environment variables, e.g. `MSYSTEM`. There\nis code in Git for Windows to ensure that that `MSYSTEM` variable is\nset, hard-coding a default.\n\nHowever, the existing solution jumps through hoops to reconstruct the\nproper default, and is even incomplete doing so, as we found out when we\nextended it to support CLANGARM64.\n\nThis is absolutely unnecessary because there is already a perfectly\nvalid `MSYSTEM` value we can use at build time. This is even true when\nbuilding the MINGW32 variant on a MINGW64 system because `makepkg-mingw`\nwill override the `MSYSTEM` value as per the `MINGW_ARCH` array.\n\nThe same is equally true for the `/mingw64`, `/mingw32` and\n`/clangarm64` prefix: those values are already available via the\n`MINGW_PREFIX` environment variable, and we just need to pass that\nsetting through.\n\nOnly when `MINGW_PREFIX` is not set (as is the case in Git for Windows'\nminimal SDK, where only `MSYSTEM` is guaranteed to be set correctly), we\nuse as fall-back the top-level directory whose name is the down-cased\nvalue of the `MSYSTEM` variable.\n\nIncidentally, this also broadens the support to all the configurations\nsupported by the MSYS2 project, i.e. clang64 & ucrt64, too.\n\nNote: This keeps the same, hard-coded MSYSTEM platform support for CMake\nas before, but drops it for Meson (because it is unclear how Meson could\ndo this in a more flexible manner).\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname                    | 14 ++++++--------\n contrib/buildsystems/CMakeLists.txt |  9 ++++++++-\n meson.build                         | 15 ++++++++++++++-\n meson_options.txt                   |  4 ++++\n 4 files changed, 32 insertions(+), 10 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 21f53e3f7e..3a90995587 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -465,14 +465,8 @@ ifeq ($(uname_S),Windows)\n \tGIT_VERSION := $(GIT_VERSION).MSVC\n \tpathsep = ;\n \t# Assume that this is built in Git for Windows' SDK\n-        ifeq (MINGW32,$(MSYSTEM))\n-\t\tprefix = /mingw32\n-        else\n-                ifeq (CLANGARM64,$(MSYSTEM))\n-\t\t\tprefix = /clangarm64\n-                else\n-\t\t\tprefix = /mingw64\n-                endif\n+        ifneq (,$(MSYSTEM))\n+\t\tprefix = $(MINGW_PREFIX)\n         endif\n \t# Prepend MSVC 64-bit tool-chain to PATH.\n \t#\n@@ -755,6 +749,10 @@ ifeq ($(uname_S),MINGW)\n \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n         endif\n         ifneq (,$(MSYSTEM))\n+                ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))\n+\t\t\t# Override if empty or does not start with a slash\n+\t\t\tMINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)\n+                endif\n \t\tprefix = $(MINGW_PREFIX)\n \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\ndiff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\nindex a57c4b464f..7285bd9ac2 100644\n--- a/contrib/buildsystems/CMakeLists.txt\n+++ b/contrib/buildsystems/CMakeLists.txt\n@@ -256,7 +256,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n \t\t\t\t_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=\".exe\"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT\n \t\t\t\tNOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0\n \t\t\t\tOVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP\n-\t\t\t\tHAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM)\n+\t\t\t\tHAVE_WPGMPTR HAVE_RTLGENRANDOM)\n+\tif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x64\")\n+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW64\" MINGW_PREFIX=\"mingw64\")\n+\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"arm64\")\n+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"CLANGARM64\" MINGW_PREFIX=\"clangarm64\")\n+\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x86\")\n+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW32\" MINGW_PREFIX=\"mingw32\")\n+\tendif()\n \tlist(APPEND compat_SOURCES\n \t\tcompat/mingw.c\n \t\tcompat/winansi.c\ndiff --git a/meson.build b/meson.build\nindex 7073d5844d..a8aba81e29 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1318,7 +1318,6 @@ elif host_machine.system() == 'windows'\n \n   libgit_c_args += [\n     '-DDETECT_MSYS_TTY',\n-    '-DENSURE_MSYSTEM_IS_SET',\n     '-DNATIVE_CRLF',\n     '-DNOGDI',\n     '-DNO_POSIX_GOODIES',\n@@ -1328,6 +1327,20 @@ elif host_machine.system() == 'windows'\n     '-D__USE_MINGW_ANSI_STDIO=0',\n   ]\n \n+  msystem = get_option('msystem')\n+  if msystem != ''\n+    mingw_prefix = get_option('mingw_prefix')\n+    if mingw_prefix == ''\n+      mingw_prefix = msystem.to_lower()\n+    elif mingw_prefix.startswith('/')\n+      mingw_prefix = mingw_prefix.substring(1)\n+    endif\n+    libgit_c_args += [\n+      '-DENSURE_MSYSTEM_IS_SET=\"' + msystem + '\"',\n+      '-DMINGW_PREFIX=\"' + mingw_prefix + '\"'\n+    ]\n+  endif\n+\n   libgit_dependencies += compiler.find_library('ntdll')\n   libgit_include_directories += 'compat/win32'\n   if compiler.get_id() == 'msvc'\ndiff --git a/meson_options.txt b/meson_options.txt\nindex dc88f130d7..becf4689bf 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -21,6 +21,10 @@ option('runtime_prefix', type: 'boolean', value: false,\n   description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')\n option('sane_tool_path', type: 'array', value: [],\n   description: 'An array of paths to pick up tools from in case the normal tools are broken or lacking.')\n+option('msystem', type: 'string', value: '',\n+  description: 'Fall-back on Windows when MSYSTEM is not set.')\n+option('mingw_prefix', type: 'string', value: '',\n+  description: 'Fall-back on Windows when MINGW_PREFIX is not set.')\n \n # Build information compiled into Git and other parts like documentation.\n option('build_date', type: 'string', value: '',\n-- \ngitgitgadget\n\n"},{"id":"550362","messageId":"60a2999b75a921fcdfd14a7f04dc288c79e56638.1786521173.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"[PATCH v2 09/12] windows: skip linking `git-<command>` for built-ins","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:49Z","receivedAt":"2026-08-12T07:53:11Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIt is merely a historical wart that, say, `git-commit` exists in the\n`libexec/git-core/` directory, a tribute to the original idea to let Git\nbe essentially a bunch of Unix shell scripts revolving around very few\n\"plumbing\" (AKA low-level) commands.\n\nGit has evolved a lot from there. These days, most of Git's\nfunctionality is contained within the `git` executable, in the form of\n\"built-in\" commands.\n\nTo accommodate for scripts that use the \"dashed\" form of Git commands,\neven today, Git provides hard-links that make the `git` executable\navailable as, say, `git-commit`, just in case that an old script has not\nbeen updated to invoke `git commit`.\n\nThose hard-links do not come cheap: they take about half a minute for\nevery build of Git on Windows, they are mistaken for taking up huge\namounts of space by some Windows Explorer versions that do not\nunderstand hard-links, and therefore many a \"bug\" report had to be\naddressed.\n\nThe \"dashed form\" has been officially deprecated in Git version 1.5.4,\nwhich was released on February 2nd, 2008, i.e. a very long time ago.\nThis deprecation was never finalized by skipping these hard-links, but\nwe can start the process now, in Git for Windows.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 3a90995587..88bbe1d78f 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -518,6 +518,7 @@ ifeq ($(uname_S),Windows)\n \tNO_POSIX_GOODIES = UnfortunatelyYes\n \tNATIVE_CRLF = YesPlease\n \tDEFAULT_HELP_FORMAT = html\n+\tSKIP_DASHED_BUILT_INS = YabbaDabbaDoo\n ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n \t# Move system config into top-level /etc/\n \tETC_GITCONFIG = ../etc/gitconfig\n@@ -710,6 +711,7 @@ ifeq ($(uname_S),MINGW)\n \tFSMONITOR_DAEMON_BACKEND = win32\n \tFSMONITOR_OS_SETTINGS = win32\n \n+\tSKIP_DASHED_BUILT_INS = YabbaDabbaDoo\n \tRUNTIME_PREFIX = YesPlease\n \tHAVE_WPGMPTR = YesWeDo\n \tNO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease\n-- \ngitgitgadget\n\n"},{"id":"550363","messageId":"1dd6ac9295ca6ca2ab9a576f37ffef532b7732c2.1786521173.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"[PATCH v2 10/12] mingw: always define `ETC_*` for MSYS2 environments","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:50Z","receivedAt":"2026-08-12T07:53:13Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nSpecial-casing even more configurations simply does not make sense.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 10 ++++------\n 1 file changed, 4 insertions(+), 6 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 88bbe1d78f..2f7d445eb3 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -519,7 +519,7 @@ ifeq ($(uname_S),Windows)\n \tNATIVE_CRLF = YesPlease\n \tDEFAULT_HELP_FORMAT = html\n \tSKIP_DASHED_BUILT_INS = YabbaDabbaDoo\n-ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n+ifneq (,$(MINGW_PREFIX))\n \t# Move system config into top-level /etc/\n \tETC_GITCONFIG = ../etc/gitconfig\n \tETC_GITATTRIBUTES = ../etc/gitattributes\n@@ -762,6 +762,9 @@ ifeq ($(uname_S),MINGW)\n                 ifeq (MINGW32,$(MSYSTEM))\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                 endif\n+\t\t# Move system config into top-level /etc/\n+\t\tETC_GITCONFIG = ../etc/gitconfig\n+\t\tETC_GITATTRIBUTES = ../etc/gitattributes\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -fstack-protector-strong\n \tEXTLIBS += -lntdll\n@@ -772,11 +775,6 @@ ifeq ($(uname_S),MINGW)\n \tUSE_GETTEXT_SCHEME = fallthrough\n \tUSE_LIBPCRE = YesPlease\n \tNO_PYTHON =\n-        ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n-\t\t# Move system config into top-level /etc/\n-\t\tETC_GITCONFIG = ../etc/gitconfig\n-\t\tETC_GITATTRIBUTES = ../etc/gitattributes\n-        endif\n endif\n ifeq ($(uname_S),QNX)\n \tCOMPAT_CFLAGS += -DSA_RESTART=0\n-- \ngitgitgadget\n\n"},{"id":"550364","messageId":"d44d05c897006b96a2b897acb030a4331170caad.1786521173.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"[PATCH v2 11/12] mingw: ensure valid CTYPE","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:51Z","receivedAt":"2026-08-12T07:53:15Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nA change between versions 2.4.1 and 2.6.0 of the MSYS2 runtime modified\nhow Cygwin's runtime (and hence Git for Windows' MSYS2 runtime\nderivative) handles locales: d16a56306d (Consolidate wctomb/mbtowc calls\nfor POSIX-1.2008, 2016-07-20).\n\nAn unintended side-effect is that \"cold-calling\" into the POSIX\nemulation will start with a locale based on the current code page,\nsomething that Git for Windows is very ill-prepared for, as it expects\nto be able to pass a command-line containing non-ASCII characters to the\nshell without having those characters munged.\n\nOne symptom of this behavior: when `git clone` or `git fetch` shell out\nto call `git-upload-pack` with a path that contains non-ASCII\ncharacters, the shell tried to interpret the entire command-line\n(including command-line parameters) as executable path, which obviously\nmust fail.\n\nThis fixes https://github.com/git-for-windows/git/issues/1036\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/mingw.c | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex e0fbd2c66d..afdc1ef2db 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3185,6 +3185,9 @@ static void setup_windows_environment(void)\n \t\tif (!tmp && (tmp = getenv(\"USERPROFILE\")))\n \t\t\tsetenv(\"HOME\", tmp, 1);\n \t}\n+\n+\tif (!getenv(\"LC_ALL\") && !getenv(\"LC_CTYPE\") && !getenv(\"LANG\"))\n+\t\tsetenv(\"LC_CTYPE\", \"C.UTF-8\", 1);\n }\n \n int mingw_platform_has_symlinks(void)\n-- \ngitgitgadget\n\n"},{"id":"550365","messageId":"679d1fdd41bbfb35a1e3137dc4fbf3c2f0caae3e.1786521173.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"[PATCH v2 12/12] mingw: allow `git.exe` to be used instead of the \"Git wrapper\"","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-08-12T07:52:52Z","receivedAt":"2026-08-12T07:53:16Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nGit for Windows wants to add `git.exe` to the users' `PATH`, without\ncluttering the latter with unnecessary executables such as `wish.exe`.\nTo that end, it invented the concept of its \"Git wrapper\", i.e. a tiny\nexecutable located in `C:\\Program Files\\Git\\cmd\\git.exe` (originally a\nCMD script) whose sole purpose is to set up a couple of environment\nvariables and then spawn the _actual_ `git.exe` (which nowadays lives in\n`C:\\Program Files\\Git\\mingw64\\bin\\git.exe` for 64-bit, and the obvious\nequivalent for 32-bit installations).\n\nCurrently, the following environment variables are set unless already\ninitialized:\n\n- `MSYSTEM`, to make sure that the MSYS2 Bash and the MSYS2 Perl\n  interpreter behave as expected, and\n\n- `PLINK_PROTOCOL`, to force PuTTY's `plink.exe` to use the SSH\n  protocol instead of Telnet,\n\n- `PATH`, to make sure that the `bin` folder in the user's home\n  directory, as well as the `/mingw64/bin` and the `/usr/bin`\n  directories are included. The trick here is that the `/mingw64/bin/`\n  and `/usr/bin/` directories are relative to the top-level installation\n  directory of Git for Windows (which the included Bash interprets as\n  `/`, i.e. as the MSYS pseudo root directory).\n\nUsing the absence of `MSYSTEM` as a tell-tale, we can detect in\n`git.exe` whether these environment variables have been initialized\nproperly. Therefore we can call `C:\\Program Files\\Git\\mingw64\\bin\\git`\nin-place after this change, without having to call Git through the Git\nwrapper.\n\nObviously, above-mentioned directories must be _prepended_ to the `PATH`\nvariable, otherwise we risk picking up executables from unrelated Git\ninstallations. We do that by constructing the new `PATH` value from\nscratch, appending `$HOME/bin` (if `HOME` is set), then the MSYS2 system\ndirectories, and then appending the original `PATH`.\n\nSide note: this modification of the `PATH` variable is independent of\nthe modification necessary to reach the executables and scripts in\n`/mingw64/libexec/git-core/`, i.e. the `GIT_EXEC_PATH`. That\nmodification is still performed by Git, elsewhere, long after making the\nchanges described above.\n\nWhile we _still_ cannot simply hard-link `mingw64\\bin\\git.exe` to `cmd`\n(because the former depends on a couple of `.dll` files that are only in\n`mingw64\\bin`, i.e. calling `...\\cmd\\git.exe` would fail to load due to\nmissing dependencies), at least we can now avoid that extra process of\nrunning the Git wrapper (which then has to wait for the spawned\n`git.exe` to finish) by calling `...\\mingw64\\bin\\git.exe` directly, via\nits absolute path.\n\nTesting this is in Git's test suite tricky: we set up a \"new\" MSYS\npseudo-root and copy the `git.exe` file into the appropriate location,\nthen verify that `MSYSTEM` is set properly, and also that the `PATH` is\nmodified so that scripts can be found in `$HOME/bin`, `/mingw64/bin/`\nand `/usr/bin/`.\n\nThis addresses https://github.com/git-for-windows/git/issues/2283\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/mingw.c        | 65 +++++++++++++++++++++++++++++++++++++++++++\n config.mak.uname      |  8 ++++--\n t/t0060-path-utils.sh | 33 +++++++++++++++++++++-\n 3 files changed, 103 insertions(+), 3 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex afdc1ef2db..563e6299bc 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3134,6 +3134,45 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)\n \treturn -1;\n }\n \n+#ifdef ENSURE_MSYSTEM_IS_SET\n+#if !defined(RUNTIME_PREFIX) || !defined(HAVE_WPGMPTR) || !defined(MINGW_PREFIX)\n+static size_t append_system_bin_dirs(char *path UNUSED, size_t size UNUSED)\n+{\n+\treturn 0;\n+}\n+#else\n+static size_t append_system_bin_dirs(char *path, size_t size)\n+{\n+\tchar prefix[32768];\n+\tconst char *slash;\n+\tsize_t len = xwcstoutf(prefix, _wpgmptr, sizeof(prefix)), off = 0;\n+\n+\tif (len == 0 || len >= sizeof(prefix) ||\n+\t    !(slash = find_last_dir_sep(prefix)))\n+\t\treturn 0;\n+\t/* strip trailing `git.exe` */\n+\tlen = slash - prefix;\n+\n+\t/* strip trailing `cmd` or `<mingw-prefix>\\bin` or `bin` or `libexec\\git-core` */\n+\tif (strip_suffix_mem(prefix, &len, \"\\\\\" MINGW_PREFIX \"\\\\libexec\\\\git-core\") ||\n+\t    strip_suffix_mem(prefix, &len, \"\\\\\" MINGW_PREFIX \"\\\\bin\"))\n+\t\toff += xsnprintf(path + off, size - off,\n+\t\t\t\t \"%.*s\\\\\" MINGW_PREFIX \"\\\\bin;\", (int)len, prefix);\n+\telse if (strip_suffix_mem(prefix, &len, \"\\\\cmd\") ||\n+\t\t strip_suffix_mem(prefix, &len, \"\\\\bin\") ||\n+\t\t strip_suffix_mem(prefix, &len, \"\\\\libexec\\\\git-core\"))\n+\t\toff += xsnprintf(path + off, size - off,\n+\t\t\t\t \"%.*s\\\\\" MINGW_PREFIX \"\\\\bin;\", (int)len, prefix);\n+\telse\n+\t\treturn 0;\n+\n+\toff += xsnprintf(path + off, size - off,\n+\t\t\t \"%.*s\\\\usr\\\\bin;\", (int)len, prefix);\n+\treturn off;\n+}\n+#endif\n+#endif\n+\n static void setup_windows_environment(void)\n {\n \tchar *tmp = getenv(\"TMPDIR\");\n@@ -3186,6 +3225,32 @@ static void setup_windows_environment(void)\n \t\t\tsetenv(\"HOME\", tmp, 1);\n \t}\n \n+\tif (!getenv(\"PLINK_PROTOCOL\"))\n+\t\tsetenv(\"PLINK_PROTOCOL\", \"ssh\", 0);\n+\n+#ifdef ENSURE_MSYSTEM_IS_SET\n+\tif (!(tmp = getenv(\"MSYSTEM\")) || !tmp[0]) {\n+\t\tconst char *home = getenv(\"HOME\"), *path = getenv(\"PATH\");\n+\t\tchar buf[32768];\n+\t\tsize_t off = 0;\n+\n+\t\tsetenv(\"MSYSTEM\", ENSURE_MSYSTEM_IS_SET, 1);\n+\n+\t\tif (home)\n+\t\t\toff += xsnprintf(buf + off, sizeof(buf) - off,\n+\t\t\t\t\t \"%s\\\\bin;\", home);\n+\t\toff += append_system_bin_dirs(buf + off, sizeof(buf) - off);\n+\t\tif (path)\n+\t\t\toff += xsnprintf(buf + off, sizeof(buf) - off,\n+\t\t\t\t\t \"%s\", path);\n+\t\telse if (off > 0)\n+\t\t\tbuf[off - 1] = '\\0';\n+\t\telse\n+\t\t\tbuf[0] = '\\0';\n+\t\tsetenv(\"PATH\", buf, 1);\n+\t}\n+#endif\n+\n \tif (!getenv(\"LC_ALL\") && !getenv(\"LC_CTYPE\") && !getenv(\"LANG\"))\n \t\tsetenv(\"LC_CTYPE\", \"C.UTF-8\", 1);\n }\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 2f7d445eb3..0b63be10b7 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -535,7 +535,9 @@ endif\n \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n \t\tcompat/win32/trace2_win32_process_info.o \\\n \t\tcompat/win32/dirent.o\n-\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n+\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY \\\n+\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" -DMINGW_PREFIX=\"\\\"$(patsubst /%,%,$(MINGW_PREFIX))\\\"\" \\\n+\t\t-DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n \tBASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE\n \t# invalidcontinue.obj allows Git's source code to close the same file\n \t# handle twice, or to access the osfhandle of an already-closed stdout\n@@ -758,7 +760,9 @@ ifeq ($(uname_S),MINGW)\n \t\tprefix = $(MINGW_PREFIX)\n \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY\n+\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY \\\n+\t\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" \\\n+\t\t\t-DMINGW_PREFIX=\"\\\"$(patsubst /%,%,$(MINGW_PREFIX))\\\"\"\n                 ifeq (MINGW32,$(MSYSTEM))\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                 endif\ndiff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh\nindex 8545cdfab5..56faf5fe73 100755\n--- a/t/t0060-path-utils.sh\n+++ b/t/t0060-path-utils.sh\n@@ -602,7 +602,8 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'RUNTIME_PREFIX wor\n \techo \"echo HERE\" | write_script pretend/libexec/git-core/git-here &&\n \tGIT_EXEC_PATH= ./pretend/bin/git here >actual &&\n \techo HERE >expect &&\n-\ttest_cmp expect actual'\n+\ttest_cmp expect actual\n+'\n \n test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works' '\n \tgit config yes.path \"%(prefix)/yes\" &&\n@@ -611,4 +612,34 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works'\n \ttest_cmp expect actual\n '\n \n+test_expect_success MINGW,RUNTIME_PREFIX 'MSYSTEM/PATH is adjusted if necessary' '\n+\tif test -z \"$MINGW_PREFIX\"\n+\tthen\n+\t\tMINGW_PREFIX=\"/$(echo \"${MSYSTEM:-MINGW64}\" | tr A-Z a-z)\"\n+\tfi &&\n+\tmkdir -p \"$HOME\"/bin pretend\"$MINGW_PREFIX\"/bin \\\n+\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core pretend/usr/bin &&\n+\tcp \"$GIT_EXEC_PATH\"/git.exe pretend\"$MINGW_PREFIX\"/bin/ &&\n+\tcp \"$GIT_EXEC_PATH\"/git.exe pretend\"$MINGW_PREFIX\"/libexec/git-core/ &&\n+\t# copy the .dll files, if any (happens when building via CMake)\n+\tif test -n \"$(ls \"$GIT_EXEC_PATH\"/*.dll 2>/dev/null)\"\n+\tthen\n+\t\tcp \"$GIT_EXEC_PATH\"/*.dll pretend\"$MINGW_PREFIX\"/bin/ &&\n+\t\tcp \"$GIT_EXEC_PATH\"/*.dll pretend\"$MINGW_PREFIX\"/libexec/git-core/\n+\tfi &&\n+\techo \"env | grep MSYSTEM=\" | write_script \"$HOME\"/bin/git-test-home &&\n+\techo \"echo ${MINGW_PREFIX#/}\" | write_script pretend\"$MINGW_PREFIX\"/bin/git-test-bin &&\n+\techo \"echo usr\" | write_script pretend/usr/bin/git-test-bin2 &&\n+\n+\t(\n+\t\tMSYSTEM= &&\n+\t\tGIT_EXEC_PATH= &&\n+\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core/git.exe test-home >actual &&\n+\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core/git.exe test-bin >>actual &&\n+\t\tpretend\"$MINGW_PREFIX\"/bin/git.exe test-bin2 >>actual\n+\t) &&\n+\ttest_write_lines MSYSTEM=$MSYSTEM \"${MINGW_PREFIX#/}\" usr >expect &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\n-- \ngitgitgadget\n"},{"id":"550411","messageId":"xmqqcxvnza6c.fsf@gitster.g","threadId":"66125","inReplyTo":"bacfe6f4-706e-670c-3466-ccb4d7caeffb@gmx.de","subject":"Re: [PATCH 12/12] mingw: allow `git.exe` to be used instead of the \"Git wrapper\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-08-12T14:27:07Z","receivedAt":"2026-08-12T14:27:10Z","isPatch":true,"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> Checking tmp[0] is a sign that we do not consider MSYSTEM set to an\n>> empty string a sane state and ENSURE_MSYSTEM_IS_SET is about\n>> correcting it, right?\n>\n> \"sane state\" is quite the strong wording for such a minor issue.\n\nWell I didn't know how important that variable is, and didn't expect\nor wish to offend you by use of that word.  Perhaps \"sane\"->\"usual\"\nwould have been better?  Sorry about uninformed choice of phrasing.\n\n>> Can $(MSYSTEM) be an empty string or undefined at the build time,\n>> making ENSURE_MSYSTEM_IS_SET set to \"\" (two double-quotes)?\n>\n> Sure it can. Just like `PATH` or `HOME` can be empty, or invalid. But the\n> person building the project has to go out of their way to make it so,\n> therefore I don't want to spend any more brain cells on that highly\n> unlikely scenario.\n\nAgain, I didn't know how unlikely it was, so I judged it based on\nthe existing practice (quoted) below.\n\n> Ciao,\n> Johannes\n>\n>> Which would mean we are exporting MSYSTEM defined to be an empty string\n>> as well with this setenv.\n>> \n>> It seems ifeq($(uname_S),MINGW) side protects against this situation\n>> by placing the cflags definition\n>> \t\n>> +\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY \\\n>> +\t\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" \\\n>> \n>> inside \"ifneq (,$(MSYSTEM))..endif\".  That way, ENSURE_MSYSTEM_IS_SET\n>> is not defined to \"\" (two double-quotes), so #ifdef ENSURE_MSYSTEM_IS_SET\n>> would not kick in.\n>> \n>> \n"},{"id":"550661","messageId":"4f4129df-681f-4e99-8b1f-8bb96e206a2d@kdbg.org","threadId":"66125","inReplyTo":"9de4ea7fc1d250e8e9dfae386424451242cb3daa.1786521173.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2026-08-15T13:44:44Z","receivedAt":"2026-08-15T13:44:54Z","isPatch":true,"body":"Am 12.08.26 um 09:52 schrieb Johannes Schindelin via GitGitGadget:\n> diff --git a/config.mak.uname b/config.mak.uname\n> index 21f53e3f7e..3a90995587 100644\n> --- a/config.mak.uname\n> +++ b/config.mak.uname\n> @@ -465,14 +465,8 @@ ifeq ($(uname_S),Windows)\n>  \tGIT_VERSION := $(GIT_VERSION).MSVC\n>  \tpathsep = ;\n>  \t# Assume that this is built in Git for Windows' SDK\n> -        ifeq (MINGW32,$(MSYSTEM))\n> -\t\tprefix = /mingw32\n> -        else\n> -                ifeq (CLANGARM64,$(MSYSTEM))\n> -\t\t\tprefix = /clangarm64\n> -                else\n> -\t\t\tprefix = /mingw64\n> -                endif\n> +        ifneq (,$(MSYSTEM))\n> +\t\tprefix = $(MINGW_PREFIX)\n>          endif\n>  \t# Prepend MSVC 64-bit tool-chain to PATH.\n>  \t#\n> @@ -755,6 +749,10 @@ ifeq ($(uname_S),MINGW)\n>  \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n>          endif\n>          ifneq (,$(MSYSTEM))\n> +                ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))\n> +\t\t\t# Override if empty or does not start with a slash\n> +\t\t\tMINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)\n> +                endif\n>  \t\tprefix = $(MINGW_PREFIX)\n>  \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n>  \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n\nAt this point, MINGW_PREFIX is only used to set prefix.\n\nOnly in 12/12 is the variable (and ENSURE_MSYSTEM_IS_SET) used to drive\nC code. Therefore, it seems that the following hunks concerning the\nCMake and meson build systems do not belong in this patch, yet, but only\nin 12/12.\n\n> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\n> index a57c4b464f..7285bd9ac2 100644\n> --- a/contrib/buildsystems/CMakeLists.txt\n> +++ b/contrib/buildsystems/CMakeLists.txt\n> @@ -256,7 +256,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n>  \t\t\t\t_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=\".exe\"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT\n>  \t\t\t\tNOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0\n>  \t\t\t\tOVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP\n> -\t\t\t\tHAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM)\n> +\t\t\t\tHAVE_WPGMPTR HAVE_RTLGENRANDOM)\n> +\tif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x64\")\n> +\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW64\" MINGW_PREFIX=\"mingw64\")\n> +\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"arm64\")\n> +\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"CLANGARM64\" MINGW_PREFIX=\"clangarm64\")\n> +\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x86\")\n> +\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW32\" MINGW_PREFIX=\"mingw32\")\n> +\tendif()\n>  \tlist(APPEND compat_SOURCES\n>  \t\tcompat/mingw.c\n>  \t\tcompat/winansi.c\n> diff --git a/meson.build b/meson.build\n> index 7073d5844d..a8aba81e29 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -1318,7 +1318,6 @@ elif host_machine.system() == 'windows'\n>  \n>    libgit_c_args += [\n>      '-DDETECT_MSYS_TTY',\n> -    '-DENSURE_MSYSTEM_IS_SET',\n>      '-DNATIVE_CRLF',\n>      '-DNOGDI',\n>      '-DNO_POSIX_GOODIES',\n> @@ -1328,6 +1327,20 @@ elif host_machine.system() == 'windows'\n>      '-D__USE_MINGW_ANSI_STDIO=0',\n>    ]\n>  \n> +  msystem = get_option('msystem')\n> +  if msystem != ''\n> +    mingw_prefix = get_option('mingw_prefix')\n> +    if mingw_prefix == ''\n> +      mingw_prefix = msystem.to_lower()\n> +    elif mingw_prefix.startswith('/')\n> +      mingw_prefix = mingw_prefix.substring(1)\n> +    endif\n> +    libgit_c_args += [\n> +      '-DENSURE_MSYSTEM_IS_SET=\"' + msystem + '\"',\n> +      '-DMINGW_PREFIX=\"' + mingw_prefix + '\"'\n> +    ]\n> +  endif\n> +\n>    libgit_dependencies += compiler.find_library('ntdll')\n>    libgit_include_directories += 'compat/win32'\n>    if compiler.get_id() == 'msvc'\n> diff --git a/meson_options.txt b/meson_options.txt\n> index dc88f130d7..becf4689bf 100644\n> --- a/meson_options.txt\n> +++ b/meson_options.txt\n> @@ -21,6 +21,10 @@ option('runtime_prefix', type: 'boolean', value: false,\n>    description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')\n>  option('sane_tool_path', type: 'array', value: [],\n>    description: 'An array of paths to pick up tools from in case the normal tools are broken or lacking.')\n> +option('msystem', type: 'string', value: '',\n> +  description: 'Fall-back on Windows when MSYSTEM is not set.')\n> +option('mingw_prefix', type: 'string', value: '',\n> +  description: 'Fall-back on Windows when MINGW_PREFIX is not set.')\n>  \n>  # Build information compiled into Git and other parts like documentation.\n>  option('build_date', type: 'string', value: '',\n\n-- Hannes\n\n"},{"id":"550662","messageId":"246b5e7f-ee43-4f3b-9760-2373a1b5b97c@kdbg.org","threadId":"66125","inReplyTo":"pull.2195.v2.git.1786521173.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 00/12] Upstream some more Git for Windows' patches","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2026-08-15T14:10:23Z","receivedAt":"2026-08-15T14:10:33Z","isPatch":true,"body":"Am 12.08.26 um 09:52 schrieb Johannes Schindelin via GitGitGadget:\n> Johannes Schindelin (12):\n>   mingw: include the Python parts in the build\n>   mingw: stop hard-coding `CC = gcc`\n>   mingw: drop the -D_USE_32BIT_TIME_T option\n>   mingw: only use -Wl,--large-address-aware for 32-bit builds\n>   mingw: avoid over-specifying `--pic-executable`\n>   mingw: set the prefix and HOST_CPU as per MSYS2's settings\n>   mingw: only enable the MSYS2-specific stuff when compiling in MSYS2\n>   mingw: rely on MSYS2's metadata instead of hard-coding it\n>   windows: skip linking `git-<command>` for built-ins\n>   mingw: always define `ETC_*` for MSYS2 environments\n>   mingw: ensure valid CTYPE\n>   mingw: allow `git.exe` to be used instead of the \"Git wrapper\"\n\nI have been building my own Windows version with a subset of these\npatches since November 25 already, specifically with 02-06, 08, and 09/12.\n\nAfter building with all of these patches instead of just the subset, I\ndon't observe any negative effects after a quick check. CI is happy as\nwell (https://github.com/j6t/git/actions/runs/31831084178).\n\n-- Hannes\n"},{"id":"551593","messageId":"xmqqbjaiw1yh.fsf@gitster.g","threadId":"66125","inReplyTo":"4f4129df-681f-4e99-8b1f-8bb96e206a2d@kdbg.org","subject":"Re: [PATCH v2 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-08-31T18:59:34Z","receivedAt":"2026-08-31T18:59:37Z","isPatch":true,"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> Am 12.08.26 um 09:52 schrieb Johannes Schindelin via GitGitGadget:\n>> diff --git a/config.mak.uname b/config.mak.uname\n>> index 21f53e3f7e..3a90995587 100644\n>> --- a/config.mak.uname\n>> +++ b/config.mak.uname\n>> @@ -465,14 +465,8 @@ ifeq ($(uname_S),Windows)\n>>  \tGIT_VERSION := $(GIT_VERSION).MSVC\n>>  \tpathsep = ;\n>>  \t# Assume that this is built in Git for Windows' SDK\n>> -        ifeq (MINGW32,$(MSYSTEM))\n>> -\t\tprefix = /mingw32\n>> -        else\n>> -                ifeq (CLANGARM64,$(MSYSTEM))\n>> -\t\t\tprefix = /clangarm64\n>> -                else\n>> -\t\t\tprefix = /mingw64\n>> -                endif\n>> +        ifneq (,$(MSYSTEM))\n>> +\t\tprefix = $(MINGW_PREFIX)\n>>          endif\n>>  \t# Prepend MSVC 64-bit tool-chain to PATH.\n>>  \t#\n>> @@ -755,6 +749,10 @@ ifeq ($(uname_S),MINGW)\n>>  \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n>>          endif\n>>          ifneq (,$(MSYSTEM))\n>> +                ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))\n>> +\t\t\t# Override if empty or does not start with a slash\n>> +\t\t\tMINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)\n>> +                endif\n>>  \t\tprefix = $(MINGW_PREFIX)\n>>  \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n>>  \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n>\n> At this point, MINGW_PREFIX is only used to set prefix.\n>\n> Only in 12/12 is the variable (and ENSURE_MSYSTEM_IS_SET) used to drive\n> C code. Therefore, it seems that the following hunks concerning the\n> CMake and meson build systems do not belong in this patch, yet, but only\n> in 12/12.\n\nHaven't heard anything on this topic for a few weeks.  Can we\nconclude it anytime soon?  I do not like too many topics that are\nalmost there hanging around only because they miss the finishing\ntouches.\n\nThanks.\n"},{"id":"552347","messageId":"a5ffcb9c-b223-af4b-7aa7-1a3db31a5f59@gmx.de","threadId":"66125","inReplyTo":"4f4129df-681f-4e99-8b1f-8bb96e206a2d@kdbg.org","subject":"Re: [PATCH v2 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2026-09-09T18:56:04Z","receivedAt":"2026-09-09T18:56:07Z","isPatch":true,"body":"Hi Hannes,\n\nOn Sat, 15 Aug 2026, Johannes Sixt wrote:\n\n> Am 12.08.26 um 09:52 schrieb Johannes Schindelin via GitGitGadget:\n> > diff --git a/config.mak.uname b/config.mak.uname\n> > index 21f53e3f7e..3a90995587 100644\n> > --- a/config.mak.uname\n> > +++ b/config.mak.uname\n> > @@ -465,14 +465,8 @@ ifeq ($(uname_S),Windows)\n> >  \tGIT_VERSION := $(GIT_VERSION).MSVC\n> >  \tpathsep = ;\n> >  \t# Assume that this is built in Git for Windows' SDK\n> > -        ifeq (MINGW32,$(MSYSTEM))\n> > -\t\tprefix = /mingw32\n> > -        else\n> > -                ifeq (CLANGARM64,$(MSYSTEM))\n> > -\t\t\tprefix = /clangarm64\n> > -                else\n> > -\t\t\tprefix = /mingw64\n> > -                endif\n> > +        ifneq (,$(MSYSTEM))\n> > +\t\tprefix = $(MINGW_PREFIX)\n> >          endif\n> >  \t# Prepend MSVC 64-bit tool-chain to PATH.\n> >  \t#\n> > @@ -755,6 +749,10 @@ ifeq ($(uname_S),MINGW)\n> >  \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n> >          endif\n> >          ifneq (,$(MSYSTEM))\n> > +                ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))\n> > +\t\t\t# Override if empty or does not start with a slash\n> > +\t\t\tMINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)\n> > +                endif\n> >  \t\tprefix = $(MINGW_PREFIX)\n> >  \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n> >  \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n> \n> At this point, MINGW_PREFIX is only used to set prefix.\n> \n> Only in 12/12 is the variable (and ENSURE_MSYSTEM_IS_SET) used to drive\n> C code. Therefore, it seems that the following hunks concerning the\n> CMake and meson build systems do not belong in this patch, yet, but only\n> in 12/12.\n\nAh, right, the following hunks do touch the ENSURE_MSYSTEM_IS_SET stuff.\nBut they _also_ add the `MINGW_PREFIX` stuff.\n\nWill disentangle.\n\nCiao,\nJohannes\n\n> \n> > diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\n> > index a57c4b464f..7285bd9ac2 100644\n> > --- a/contrib/buildsystems/CMakeLists.txt\n> > +++ b/contrib/buildsystems/CMakeLists.txt\n> > @@ -256,7 +256,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n> >  \t\t\t\t_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=\".exe\"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT\n> >  \t\t\t\tNOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0\n> >  \t\t\t\tOVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP\n> > -\t\t\t\tHAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM)\n> > +\t\t\t\tHAVE_WPGMPTR HAVE_RTLGENRANDOM)\n> > +\tif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x64\")\n> > +\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW64\" MINGW_PREFIX=\"mingw64\")\n> > +\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"arm64\")\n> > +\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"CLANGARM64\" MINGW_PREFIX=\"clangarm64\")\n> > +\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x86\")\n> > +\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW32\" MINGW_PREFIX=\"mingw32\")\n> > +\tendif()\n> >  \tlist(APPEND compat_SOURCES\n> >  \t\tcompat/mingw.c\n> >  \t\tcompat/winansi.c\n> > diff --git a/meson.build b/meson.build\n> > index 7073d5844d..a8aba81e29 100644\n> > --- a/meson.build\n> > +++ b/meson.build\n> > @@ -1318,7 +1318,6 @@ elif host_machine.system() == 'windows'\n> >  \n> >    libgit_c_args += [\n> >      '-DDETECT_MSYS_TTY',\n> > -    '-DENSURE_MSYSTEM_IS_SET',\n> >      '-DNATIVE_CRLF',\n> >      '-DNOGDI',\n> >      '-DNO_POSIX_GOODIES',\n> > @@ -1328,6 +1327,20 @@ elif host_machine.system() == 'windows'\n> >      '-D__USE_MINGW_ANSI_STDIO=0',\n> >    ]\n> >  \n> > +  msystem = get_option('msystem')\n> > +  if msystem != ''\n> > +    mingw_prefix = get_option('mingw_prefix')\n> > +    if mingw_prefix == ''\n> > +      mingw_prefix = msystem.to_lower()\n> > +    elif mingw_prefix.startswith('/')\n> > +      mingw_prefix = mingw_prefix.substring(1)\n> > +    endif\n> > +    libgit_c_args += [\n> > +      '-DENSURE_MSYSTEM_IS_SET=\"' + msystem + '\"',\n> > +      '-DMINGW_PREFIX=\"' + mingw_prefix + '\"'\n> > +    ]\n> > +  endif\n> > +\n> >    libgit_dependencies += compiler.find_library('ntdll')\n> >    libgit_include_directories += 'compat/win32'\n> >    if compiler.get_id() == 'msvc'\n> > diff --git a/meson_options.txt b/meson_options.txt\n> > index dc88f130d7..becf4689bf 100644\n> > --- a/meson_options.txt\n> > +++ b/meson_options.txt\n> > @@ -21,6 +21,10 @@ option('runtime_prefix', type: 'boolean', value: false,\n> >    description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')\n> >  option('sane_tool_path', type: 'array', value: [],\n> >    description: 'An array of paths to pick up tools from in case the normal tools are broken or lacking.')\n> > +option('msystem', type: 'string', value: '',\n> > +  description: 'Fall-back on Windows when MSYSTEM is not set.')\n> > +option('mingw_prefix', type: 'string', value: '',\n> > +  description: 'Fall-back on Windows when MINGW_PREFIX is not set.')\n> >  \n> >  # Build information compiled into Git and other parts like documentation.\n> >  option('build_date', type: 'string', value: '',\n> \n> -- Hannes\n> \n> \n"},{"id":"552349","messageId":"3b6d1078-202b-d779-355a-df376c139249@gmx.de","threadId":"66125","inReplyTo":"a5ffcb9c-b223-af4b-7aa7-1a3db31a5f59@gmx.de","subject":"Re: [PATCH v2 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2026-09-09T19:09:38Z","receivedAt":"2026-09-09T19:09:40Z","isPatch":true,"body":"Hi Hannes,\n\nOn Wed, 9 Sep 2026, Johannes Schindelin wrote:\n\n> On Sat, 15 Aug 2026, Johannes Sixt wrote:\n> \n> > Am 12.08.26 um 09:52 schrieb Johannes Schindelin via GitGitGadget:\n> > > @@ -755,6 +749,10 @@ ifeq ($(uname_S),MINGW)\n> > >  \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n> > >          endif\n> > >          ifneq (,$(MSYSTEM))\n> > > +                ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))\n> > > +\t\t\t# Override if empty or does not start with a slash\n> > > +\t\t\tMINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)\n> > > +                endif\n> > >  \t\tprefix = $(MINGW_PREFIX)\n> > >  \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n> > >  \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n> > \n> > At this point, MINGW_PREFIX is only used to set prefix.\n> > \n> > Only in 12/12 is the variable (and ENSURE_MSYSTEM_IS_SET) used to drive\n> > C code. Therefore, it seems that the following hunks concerning the\n> > CMake and meson build systems do not belong in this patch, yet, but only\n> > in 12/12.\n> \n> Ah, right, the following hunks do touch the ENSURE_MSYSTEM_IS_SET stuff.\n> But they _also_ add the `MINGW_PREFIX` stuff.\n\nGah. My assessment is incorrect. At this point in the patch series, the\n`MINGW_PREFIX` constant isn't used anywhere in the C code. So you were\nabsolutely right, those hunks do need to move to 12/12 wholesale.\n\nSorry about the slalom,\nJohannes\n"},{"id":"552350","messageId":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH v3 00/12] Upstream some more Git for Windows' patches","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:04Z","receivedAt":"2026-09-09T19:17:18Z","isPatch":true,"body":"When rebasing a Git for Windows commit to enable Rust in Windows CI, I\nnoticed just how many of the preceding commits touching adjacent code\nhaven't been upstreamed yet. This patch series rectifies that.\n\nChanges since v2:\n\n * Moved some hunks that belonged into 12/12 out of 08/12.\n * Dropped a fly-by style cleanup from t0060.\n\nChanges since v1:\n\n * Fixed the meson-side handling of the MINGW_PREFIX constant (this was not\n   noticed in the Git for Windows project because it does not use Meson to\n   build the project).\n\nJohannes Schindelin (12):\n  mingw: include the Python parts in the build\n  mingw: stop hard-coding `CC = gcc`\n  mingw: drop the -D_USE_32BIT_TIME_T option\n  mingw: only use -Wl,--large-address-aware for 32-bit builds\n  mingw: avoid over-specifying `--pic-executable`\n  mingw: set the prefix and HOST_CPU as per MSYS2's settings\n  mingw: only enable the MSYS2-specific stuff when compiling in MSYS2\n  mingw: rely on MSYS2's metadata instead of hard-coding it\n  windows: skip linking `git-<command>` for built-ins\n  mingw: always define `ETC_*` for MSYS2 environments\n  mingw: ensure valid CTYPE\n  mingw: allow `git.exe` to be used instead of the \"Git wrapper\"\n\n compat/mingw.c                      | 68 +++++++++++++++++++++++++++++\n config.mak.uname                    | 61 ++++++++++++--------------\n contrib/buildsystems/CMakeLists.txt |  9 +++-\n meson.build                         | 15 ++++++-\n meson_options.txt                   |  4 ++\n t/t0060-path-utils.sh               | 30 +++++++++++++\n 6 files changed, 151 insertions(+), 36 deletions(-)\n\n\nbase-commit: 5b2471720c93ee30e5764a19f3d3b3ae9ec9712a\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2195%2Fdscho%2Fupstream-some-more-git-for-windows-patches-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2195/dscho/upstream-some-more-git-for-windows-patches-v3\nPull-Request: https://github.com/gitgitgadget/git/pull/2195\n\nRange-diff vs v2:\n\n  1:  fd594ffa6c =  1:  fd594ffa6c mingw: include the Python parts in the build\n  2:  47fc974582 =  2:  47fc974582 mingw: stop hard-coding `CC = gcc`\n  3:  53f1fd5763 =  3:  53f1fd5763 mingw: drop the -D_USE_32BIT_TIME_T option\n  4:  ad96aedda6 =  4:  ad96aedda6 mingw: only use -Wl,--large-address-aware for 32-bit builds\n  5:  d67201f9b3 =  5:  d67201f9b3 mingw: avoid over-specifying `--pic-executable`\n  6:  b49c42c50d =  6:  b49c42c50d mingw: set the prefix and HOST_CPU as per MSYS2's settings\n  7:  b00d242621 =  7:  b00d242621 mingw: only enable the MSYS2-specific stuff when compiling in MSYS2\n  8:  9de4ea7fc1 !  8:  4cc14553dc mingw: rely on MSYS2's metadata instead of hard-coding it\n     @@ config.mak.uname: ifeq ($(uname_S),MINGW)\n       \t\tprefix = $(MINGW_PREFIX)\n       \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n       \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n     -\n     - ## contrib/buildsystems/CMakeLists.txt ##\n     -@@ contrib/buildsystems/CMakeLists.txt: if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n     - \t\t\t\t_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=\".exe\"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT\n     - \t\t\t\tNOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0\n     - \t\t\t\tOVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP\n     --\t\t\t\tHAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM)\n     -+\t\t\t\tHAVE_WPGMPTR HAVE_RTLGENRANDOM)\n     -+\tif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x64\")\n     -+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW64\" MINGW_PREFIX=\"mingw64\")\n     -+\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"arm64\")\n     -+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"CLANGARM64\" MINGW_PREFIX=\"clangarm64\")\n     -+\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x86\")\n     -+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW32\" MINGW_PREFIX=\"mingw32\")\n     -+\tendif()\n     - \tlist(APPEND compat_SOURCES\n     - \t\tcompat/mingw.c\n     - \t\tcompat/winansi.c\n     -\n     - ## meson.build ##\n     -@@ meson.build: elif host_machine.system() == 'windows'\n     - \n     -   libgit_c_args += [\n     -     '-DDETECT_MSYS_TTY',\n     --    '-DENSURE_MSYSTEM_IS_SET',\n     -     '-DNATIVE_CRLF',\n     -     '-DNOGDI',\n     -     '-DNO_POSIX_GOODIES',\n     -@@ meson.build: elif host_machine.system() == 'windows'\n     -     '-D__USE_MINGW_ANSI_STDIO=0',\n     -   ]\n     - \n     -+  msystem = get_option('msystem')\n     -+  if msystem != ''\n     -+    mingw_prefix = get_option('mingw_prefix')\n     -+    if mingw_prefix == ''\n     -+      mingw_prefix = msystem.to_lower()\n     -+    elif mingw_prefix.startswith('/')\n     -+      mingw_prefix = mingw_prefix.substring(1)\n     -+    endif\n     -+    libgit_c_args += [\n     -+      '-DENSURE_MSYSTEM_IS_SET=\"' + msystem + '\"',\n     -+      '-DMINGW_PREFIX=\"' + mingw_prefix + '\"'\n     -+    ]\n     -+  endif\n     -+\n     -   libgit_dependencies += compiler.find_library('ntdll')\n     -   libgit_include_directories += 'compat/win32'\n     -   if compiler.get_id() == 'msvc'\n     -\n     - ## meson_options.txt ##\n     -@@ meson_options.txt: option('runtime_prefix', type: 'boolean', value: false,\n     -   description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')\n     - option('sane_tool_path', type: 'array', value: [],\n     -   description: 'An array of paths to pick up tools from in case the normal tools are broken or lacking.')\n     -+option('msystem', type: 'string', value: '',\n     -+  description: 'Fall-back on Windows when MSYSTEM is not set.')\n     -+option('mingw_prefix', type: 'string', value: '',\n     -+  description: 'Fall-back on Windows when MINGW_PREFIX is not set.')\n     - \n     - # Build information compiled into Git and other parts like documentation.\n     - option('build_date', type: 'string', value: '',\n  9:  60a2999b75 =  9:  19c600cbee windows: skip linking `git-<command>` for built-ins\n 10:  1dd6ac9295 = 10:  b8cc067e92 mingw: always define `ETC_*` for MSYS2 environments\n 11:  d44d05c897 = 11:  09c90015fb mingw: ensure valid CTYPE\n 12:  679d1fdd41 ! 12:  4a4f24a1ba mingw: allow `git.exe` to be used instead of the \"Git wrapper\"\n     @@ config.mak.uname: ifeq ($(uname_S),MINGW)\n       \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                       endif\n      \n     - ## t/t0060-path-utils.sh ##\n     -@@ t/t0060-path-utils.sh: test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'RUNTIME_PREFIX wor\n     - \techo \"echo HERE\" | write_script pretend/libexec/git-core/git-here &&\n     - \tGIT_EXEC_PATH= ./pretend/bin/git here >actual &&\n     - \techo HERE >expect &&\n     --\ttest_cmp expect actual'\n     -+\ttest_cmp expect actual\n     -+'\n     + ## contrib/buildsystems/CMakeLists.txt ##\n     +@@ contrib/buildsystems/CMakeLists.txt: if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n     + \t\t\t\t_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=\".exe\"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT\n     + \t\t\t\tNOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0\n     + \t\t\t\tOVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP\n     +-\t\t\t\tHAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM)\n     ++\t\t\t\tHAVE_WPGMPTR HAVE_RTLGENRANDOM)\n     ++\tif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x64\")\n     ++\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW64\" MINGW_PREFIX=\"mingw64\")\n     ++\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"arm64\")\n     ++\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"CLANGARM64\" MINGW_PREFIX=\"clangarm64\")\n     ++\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x86\")\n     ++\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW32\" MINGW_PREFIX=\"mingw32\")\n     ++\tendif()\n     + \tlist(APPEND compat_SOURCES\n     + \t\tcompat/mingw.c\n     + \t\tcompat/winansi.c\n     +\n     + ## meson.build ##\n     +@@ meson.build: elif host_machine.system() == 'windows'\n     + \n     +   libgit_c_args += [\n     +     '-DDETECT_MSYS_TTY',\n     +-    '-DENSURE_MSYSTEM_IS_SET',\n     +     '-DNATIVE_CRLF',\n     +     '-DNOGDI',\n     +     '-DNO_POSIX_GOODIES',\n     +@@ meson.build: elif host_machine.system() == 'windows'\n     +     '-D__USE_MINGW_ANSI_STDIO=0',\n     +   ]\n       \n     - test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works' '\n     - \tgit config yes.path \"%(prefix)/yes\" &&\n     ++  msystem = get_option('msystem')\n     ++  if msystem != ''\n     ++    mingw_prefix = get_option('mingw_prefix')\n     ++    if mingw_prefix == ''\n     ++      mingw_prefix = msystem.to_lower()\n     ++    elif mingw_prefix.startswith('/')\n     ++      mingw_prefix = mingw_prefix.substring(1)\n     ++    endif\n     ++    libgit_c_args += [\n     ++      '-DENSURE_MSYSTEM_IS_SET=\"' + msystem + '\"',\n     ++      '-DMINGW_PREFIX=\"' + mingw_prefix + '\"'\n     ++    ]\n     ++  endif\n     ++\n     +   libgit_dependencies += compiler.find_library('ntdll')\n     +   libgit_include_directories += 'compat/win32'\n     +   if compiler.get_id() == 'msvc'\n     +\n     + ## meson_options.txt ##\n     +@@ meson_options.txt: option('runtime_prefix', type: 'boolean', value: false,\n     +   description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')\n     + option('sane_tool_path', type: 'array', value: [],\n     +   description: 'An array of paths to pick up tools from in case the normal tools are broken or lacking.')\n     ++option('msystem', type: 'string', value: '',\n     ++  description: 'Fall-back on Windows when MSYSTEM is not set.')\n     ++option('mingw_prefix', type: 'string', value: '',\n     ++  description: 'Fall-back on Windows when MINGW_PREFIX is not set.')\n     + \n     + # Build information compiled into Git and other parts like documentation.\n     + option('build_date', type: 'string', value: '',\n     +\n     + ## t/t0060-path-utils.sh ##\n      @@ t/t0060-path-utils.sh: test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works'\n       \ttest_cmp expect actual\n       '\n\n-- \ngitgitgadget\n"},{"id":"552351","messageId":"fd594ffa6cfacaf7896ab312d51d39f30d09be81.1788981436.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","subject":"[PATCH v3 01/12] mingw: include the Python parts in the build","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:05Z","receivedAt":"2026-09-09T19:17:20Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWhile Git for Windows does not _ship_ Python (in order to save on\nbandwidth), MSYS2 provides very fine Python interpreters that users can\neasily take advantage of, by using Git for Windows within its SDK.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 9ebd240378..8dd8acfaa5 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -781,6 +781,7 @@ ifeq ($(uname_S),MINGW)\n \tHAVE_LIBCHARSET_H = YesPlease\n \tUSE_GETTEXT_SCHEME = fallthrough\n \tUSE_LIBPCRE = YesPlease\n+\tNO_PYTHON =\n         ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n \t\t# Move system config into top-level /etc/\n \t\tETC_GITCONFIG = ../etc/gitconfig\n-- \ngitgitgadget\n\n"},{"id":"552352","messageId":"47fc97458247529f9d2205cd7c0bdf5125ad8832.1788981436.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","subject":"[PATCH v3 02/12] mingw: stop hard-coding `CC = gcc`","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:06Z","receivedAt":"2026-09-09T19:17:22Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThis is no longer true in general, not with supporting Clang out of the\nbox.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 8dd8acfaa5..a464b2009c 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -771,7 +771,6 @@ ifeq ($(uname_S),MINGW)\n \t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n \t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n         endif\n-\tCC = gcc\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n \t\t-fstack-protector-strong\n \tEXTLIBS += -lntdll\n-- \ngitgitgadget\n\n"},{"id":"552353","messageId":"53f1fd576379a7331e827a2384605a1445f85d86.1788981436.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","subject":"[PATCH v3 03/12] mingw: drop the -D_USE_32BIT_TIME_T option","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:07Z","receivedAt":"2026-09-09T19:17:23Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThis option was added in fa93bb20d72 (MinGW: Fix stat definitions to\nwork with MinGW runtime version 4.0, 2013-09-11), i.e. a _long_ time\nago. So long, in fact, that it still targeted MinGW. But we switched to\nmingw-w64 in 2015, which seems not to share the problem, and therefore\ndoes not require a fix.\n\nEven worse: This flag is incompatible with UCRT64, which we are about to\nsupport by way of upstreaming `mingw-w64-git` to the MSYS2 project, see\nhttps://github.com/msys2/MINGW-packages/pull/26470 for details.\n\nSo let's send that option into its well-deserved retirement.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex a464b2009c..cc0ed63af3 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -768,7 +768,6 @@ ifeq ($(uname_S),MINGW)\n \t\tHOST_CPU = aarch64\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n         else\n-\t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n \t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n-- \ngitgitgadget\n\n"},{"id":"552354","messageId":"ad96aedda6a2b22b80200a035b714ca111b97cdc.1788981436.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","subject":"[PATCH v3 04/12] mingw: only use -Wl,--large-address-aware for 32-bit builds","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:08Z","receivedAt":"2026-09-09T19:17:25Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThat option only matters there, and is in fact only really understood in\nthose builds; UCRT64 versions of GCC, for example, do not know what to\ndo with that option.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex cc0ed63af3..b667c693ec 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -757,9 +757,8 @@ ifeq ($(uname_S),MINGW)\n         ifeq (MINGW32,$(MSYSTEM))\n \t\tprefix = /mingw32\n \t\tHOST_CPU = i686\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup\n-        endif\n-        ifeq (MINGW64,$(MSYSTEM))\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup -Wl,--large-address-aware\n+        else ifeq (MINGW64,$(MSYSTEM))\n \t\tprefix = /mingw64\n \t\tHOST_CPU = x86_64\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n@@ -768,7 +767,6 @@ ifeq ($(uname_S),MINGW)\n \t\tHOST_CPU = aarch64\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n         else\n-\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n \t\t-fstack-protector-strong\n-- \ngitgitgadget\n\n"},{"id":"552355","messageId":"d67201f9b3ad288373fcbb73fed15356b7a795d8.1788981436.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","subject":"[PATCH v3 05/12] mingw: avoid over-specifying `--pic-executable`","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:09Z","receivedAt":"2026-09-09T19:17:27Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIn bf2d5d8239e (Don't let ld strip relocations, 2016-01-16) (picked from\nhttps://github.com/git-for-windows/git/pull/612/commits/6a237925bf10),\nGit for Windows introduced the `-Wl,-pic-executable` flag, specifying\nthe exact entry point via `-e`. This required discerning between i686\nand x86_64 code because the former required the symbol to be prefixed\nwith an underscore, the latter did not.\n\nAs per https://sourceware.org/bugzilla/show_bug.cgi?id=10865, the\nspecified symbols are already the default, though.\n\nSo let's drop the overly-specific definition.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex b667c693ec..f6387f4c7b 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -757,15 +757,15 @@ ifeq ($(uname_S),MINGW)\n         ifeq (MINGW32,$(MSYSTEM))\n \t\tprefix = /mingw32\n \t\tHOST_CPU = i686\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup -Wl,--large-address-aware\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable -Wl,--large-address-aware\n         else ifeq (MINGW64,$(MSYSTEM))\n \t\tprefix = /mingw64\n \t\tHOST_CPU = x86_64\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable\n         else ifeq (CLANGARM64,$(MSYSTEM))\n \t\tprefix = /clangarm64\n \t\tHOST_CPU = aarch64\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable\n         else\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n-- \ngitgitgadget\n\n"},{"id":"552356","messageId":"b49c42c50d0fdae43224b711ae740097e9343d53.1788981436.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","subject":"[PATCH v3 06/12] mingw: set the prefix and HOST_CPU as per MSYS2's settings","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:10Z","receivedAt":"2026-09-09T19:17:28Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nMSYS2 already defines a couple of helpful environment variables, and we\ncan use those to infer the installation location as well as the CPU. No\nneed for hard-coding ;-)\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 18 ++++++------------\n 1 file changed, 6 insertions(+), 12 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex f6387f4c7b..8363239513 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -754,19 +754,13 @@ ifeq ($(uname_S),MINGW)\n         ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))\n \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n         endif\n-        ifeq (MINGW32,$(MSYSTEM))\n-\t\tprefix = /mingw32\n-\t\tHOST_CPU = i686\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable -Wl,--large-address-aware\n-        else ifeq (MINGW64,$(MSYSTEM))\n-\t\tprefix = /mingw64\n-\t\tHOST_CPU = x86_64\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-        else ifeq (CLANGARM64,$(MSYSTEM))\n-\t\tprefix = /clangarm64\n-\t\tHOST_CPU = aarch64\n+        ifneq (,$(MSYSTEM))\n+\t\tprefix = $(MINGW_PREFIX)\n+\t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-        else\n+                ifeq (MINGW32,$(MSYSTEM))\n+\t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n+                endif\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n \t\t-fstack-protector-strong\n-- \ngitgitgadget\n\n"},{"id":"552357","messageId":"b00d242621ad2da67cd07edf34d3c8d3bb19f638.1788981436.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","subject":"[PATCH v3 07/12] mingw: only enable the MSYS2-specific stuff when compiling in MSYS2","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:11Z","receivedAt":"2026-09-09T19:17:30Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe tell-tale is the presence of the `MSYSTEM` value while compiling, of\ncourse. In that case, we want to ensure that `MSYSTEM` is set when\nrunning `git.exe`, and also enable the magic MSYS2 tty detection.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 8363239513..21f53e3f7e 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -758,12 +758,12 @@ ifeq ($(uname_S),MINGW)\n \t\tprefix = $(MINGW_PREFIX)\n \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n+\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY\n                 ifeq (MINGW32,$(MSYSTEM))\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                 endif\n         endif\n-\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n-\t\t-fstack-protector-strong\n+\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -fstack-protector-strong\n \tEXTLIBS += -lntdll\n \tEXTRA_PROGRAMS += headless-git$X\n \tINSTALL = /bin/install\n-- \ngitgitgadget\n\n"},{"id":"552358","messageId":"4cc14553dcddbd7fb1a49864ae988bad19626391.1788981436.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","subject":"[PATCH v3 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:12Z","receivedAt":"2026-09-09T19:17:32Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nMSYS2 defines some helpful environment variables, e.g. `MSYSTEM`. There\nis code in Git for Windows to ensure that that `MSYSTEM` variable is\nset, hard-coding a default.\n\nHowever, the existing solution jumps through hoops to reconstruct the\nproper default, and is even incomplete doing so, as we found out when we\nextended it to support CLANGARM64.\n\nThis is absolutely unnecessary because there is already a perfectly\nvalid `MSYSTEM` value we can use at build time. This is even true when\nbuilding the MINGW32 variant on a MINGW64 system because `makepkg-mingw`\nwill override the `MSYSTEM` value as per the `MINGW_ARCH` array.\n\nThe same is equally true for the `/mingw64`, `/mingw32` and\n`/clangarm64` prefix: those values are already available via the\n`MINGW_PREFIX` environment variable, and we just need to pass that\nsetting through.\n\nOnly when `MINGW_PREFIX` is not set (as is the case in Git for Windows'\nminimal SDK, where only `MSYSTEM` is guaranteed to be set correctly), we\nuse as fall-back the top-level directory whose name is the down-cased\nvalue of the `MSYSTEM` variable.\n\nIncidentally, this also broadens the support to all the configurations\nsupported by the MSYS2 project, i.e. clang64 & ucrt64, too.\n\nNote: This keeps the same, hard-coded MSYSTEM platform support for CMake\nas before, but drops it for Meson (because it is unclear how Meson could\ndo this in a more flexible manner).\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 14 ++++++--------\n 1 file changed, 6 insertions(+), 8 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 21f53e3f7e..3a90995587 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -465,14 +465,8 @@ ifeq ($(uname_S),Windows)\n \tGIT_VERSION := $(GIT_VERSION).MSVC\n \tpathsep = ;\n \t# Assume that this is built in Git for Windows' SDK\n-        ifeq (MINGW32,$(MSYSTEM))\n-\t\tprefix = /mingw32\n-        else\n-                ifeq (CLANGARM64,$(MSYSTEM))\n-\t\t\tprefix = /clangarm64\n-                else\n-\t\t\tprefix = /mingw64\n-                endif\n+        ifneq (,$(MSYSTEM))\n+\t\tprefix = $(MINGW_PREFIX)\n         endif\n \t# Prepend MSVC 64-bit tool-chain to PATH.\n \t#\n@@ -755,6 +749,10 @@ ifeq ($(uname_S),MINGW)\n \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n         endif\n         ifneq (,$(MSYSTEM))\n+                ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))\n+\t\t\t# Override if empty or does not start with a slash\n+\t\t\tMINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)\n+                endif\n \t\tprefix = $(MINGW_PREFIX)\n \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-- \ngitgitgadget\n\n"},{"id":"552359","messageId":"19c600cbeead056c8725e7fa34e6f8aeb46df54a.1788981436.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","subject":"[PATCH v3 09/12] windows: skip linking `git-<command>` for built-ins","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:13Z","receivedAt":"2026-09-09T19:17:34Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIt is merely a historical wart that, say, `git-commit` exists in the\n`libexec/git-core/` directory, a tribute to the original idea to let Git\nbe essentially a bunch of Unix shell scripts revolving around very few\n\"plumbing\" (AKA low-level) commands.\n\nGit has evolved a lot from there. These days, most of Git's\nfunctionality is contained within the `git` executable, in the form of\n\"built-in\" commands.\n\nTo accommodate for scripts that use the \"dashed\" form of Git commands,\neven today, Git provides hard-links that make the `git` executable\navailable as, say, `git-commit`, just in case that an old script has not\nbeen updated to invoke `git commit`.\n\nThose hard-links do not come cheap: they take about half a minute for\nevery build of Git on Windows, they are mistaken for taking up huge\namounts of space by some Windows Explorer versions that do not\nunderstand hard-links, and therefore many a \"bug\" report had to be\naddressed.\n\nThe \"dashed form\" has been officially deprecated in Git version 1.5.4,\nwhich was released on February 2nd, 2008, i.e. a very long time ago.\nThis deprecation was never finalized by skipping these hard-links, but\nwe can start the process now, in Git for Windows.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 3a90995587..88bbe1d78f 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -518,6 +518,7 @@ ifeq ($(uname_S),Windows)\n \tNO_POSIX_GOODIES = UnfortunatelyYes\n \tNATIVE_CRLF = YesPlease\n \tDEFAULT_HELP_FORMAT = html\n+\tSKIP_DASHED_BUILT_INS = YabbaDabbaDoo\n ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n \t# Move system config into top-level /etc/\n \tETC_GITCONFIG = ../etc/gitconfig\n@@ -710,6 +711,7 @@ ifeq ($(uname_S),MINGW)\n \tFSMONITOR_DAEMON_BACKEND = win32\n \tFSMONITOR_OS_SETTINGS = win32\n \n+\tSKIP_DASHED_BUILT_INS = YabbaDabbaDoo\n \tRUNTIME_PREFIX = YesPlease\n \tHAVE_WPGMPTR = YesWeDo\n \tNO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease\n-- \ngitgitgadget\n\n"},{"id":"552360","messageId":"b8cc067e9236ead076811b337de72a75a7af52aa.1788981436.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","subject":"[PATCH v3 10/12] mingw: always define `ETC_*` for MSYS2 environments","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:14Z","receivedAt":"2026-09-09T19:17:35Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nSpecial-casing even more configurations simply does not make sense.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 10 ++++------\n 1 file changed, 4 insertions(+), 6 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 88bbe1d78f..2f7d445eb3 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -519,7 +519,7 @@ ifeq ($(uname_S),Windows)\n \tNATIVE_CRLF = YesPlease\n \tDEFAULT_HELP_FORMAT = html\n \tSKIP_DASHED_BUILT_INS = YabbaDabbaDoo\n-ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n+ifneq (,$(MINGW_PREFIX))\n \t# Move system config into top-level /etc/\n \tETC_GITCONFIG = ../etc/gitconfig\n \tETC_GITATTRIBUTES = ../etc/gitattributes\n@@ -762,6 +762,9 @@ ifeq ($(uname_S),MINGW)\n                 ifeq (MINGW32,$(MSYSTEM))\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                 endif\n+\t\t# Move system config into top-level /etc/\n+\t\tETC_GITCONFIG = ../etc/gitconfig\n+\t\tETC_GITATTRIBUTES = ../etc/gitattributes\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -fstack-protector-strong\n \tEXTLIBS += -lntdll\n@@ -772,11 +775,6 @@ ifeq ($(uname_S),MINGW)\n \tUSE_GETTEXT_SCHEME = fallthrough\n \tUSE_LIBPCRE = YesPlease\n \tNO_PYTHON =\n-        ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n-\t\t# Move system config into top-level /etc/\n-\t\tETC_GITCONFIG = ../etc/gitconfig\n-\t\tETC_GITATTRIBUTES = ../etc/gitattributes\n-        endif\n endif\n ifeq ($(uname_S),QNX)\n \tCOMPAT_CFLAGS += -DSA_RESTART=0\n-- \ngitgitgadget\n\n"},{"id":"552361","messageId":"09c90015fb129129ca2f35945269d46611efbd24.1788981436.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","subject":"[PATCH v3 11/12] mingw: ensure valid CTYPE","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:15Z","receivedAt":"2026-09-09T19:17:37Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nA change between versions 2.4.1 and 2.6.0 of the MSYS2 runtime modified\nhow Cygwin's runtime (and hence Git for Windows' MSYS2 runtime\nderivative) handles locales: d16a56306d (Consolidate wctomb/mbtowc calls\nfor POSIX-1.2008, 2016-07-20).\n\nAn unintended side-effect is that \"cold-calling\" into the POSIX\nemulation will start with a locale based on the current code page,\nsomething that Git for Windows is very ill-prepared for, as it expects\nto be able to pass a command-line containing non-ASCII characters to the\nshell without having those characters munged.\n\nOne symptom of this behavior: when `git clone` or `git fetch` shell out\nto call `git-upload-pack` with a path that contains non-ASCII\ncharacters, the shell tried to interpret the entire command-line\n(including command-line parameters) as executable path, which obviously\nmust fail.\n\nThis fixes https://github.com/git-for-windows/git/issues/1036\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/mingw.c | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex e0fbd2c66d..afdc1ef2db 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3185,6 +3185,9 @@ static void setup_windows_environment(void)\n \t\tif (!tmp && (tmp = getenv(\"USERPROFILE\")))\n \t\t\tsetenv(\"HOME\", tmp, 1);\n \t}\n+\n+\tif (!getenv(\"LC_ALL\") && !getenv(\"LC_CTYPE\") && !getenv(\"LANG\"))\n+\t\tsetenv(\"LC_CTYPE\", \"C.UTF-8\", 1);\n }\n \n int mingw_platform_has_symlinks(void)\n-- \ngitgitgadget\n\n"},{"id":"552362","messageId":"4a4f24a1ba0fce48dce8f77737a5153cf304aa2c.1788981436.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v3.git.1788981436.gitgitgadget@gmail.com","subject":"[PATCH v3 12/12] mingw: allow `git.exe` to be used instead of the \"Git wrapper\"","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-09T19:17:16Z","receivedAt":"2026-09-09T19:17:39Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nGit for Windows wants to add `git.exe` to the users' `PATH`, without\ncluttering the latter with unnecessary executables such as `wish.exe`.\nTo that end, it invented the concept of its \"Git wrapper\", i.e. a tiny\nexecutable located in `C:\\Program Files\\Git\\cmd\\git.exe` (originally a\nCMD script) whose sole purpose is to set up a couple of environment\nvariables and then spawn the _actual_ `git.exe` (which nowadays lives in\n`C:\\Program Files\\Git\\mingw64\\bin\\git.exe` for 64-bit, and the obvious\nequivalent for 32-bit installations).\n\nCurrently, the following environment variables are set unless already\ninitialized:\n\n- `MSYSTEM`, to make sure that the MSYS2 Bash and the MSYS2 Perl\n  interpreter behave as expected, and\n\n- `PLINK_PROTOCOL`, to force PuTTY's `plink.exe` to use the SSH\n  protocol instead of Telnet,\n\n- `PATH`, to make sure that the `bin` folder in the user's home\n  directory, as well as the `/mingw64/bin` and the `/usr/bin`\n  directories are included. The trick here is that the `/mingw64/bin/`\n  and `/usr/bin/` directories are relative to the top-level installation\n  directory of Git for Windows (which the included Bash interprets as\n  `/`, i.e. as the MSYS pseudo root directory).\n\nUsing the absence of `MSYSTEM` as a tell-tale, we can detect in\n`git.exe` whether these environment variables have been initialized\nproperly. Therefore we can call `C:\\Program Files\\Git\\mingw64\\bin\\git`\nin-place after this change, without having to call Git through the Git\nwrapper.\n\nObviously, above-mentioned directories must be _prepended_ to the `PATH`\nvariable, otherwise we risk picking up executables from unrelated Git\ninstallations. We do that by constructing the new `PATH` value from\nscratch, appending `$HOME/bin` (if `HOME` is set), then the MSYS2 system\ndirectories, and then appending the original `PATH`.\n\nSide note: this modification of the `PATH` variable is independent of\nthe modification necessary to reach the executables and scripts in\n`/mingw64/libexec/git-core/`, i.e. the `GIT_EXEC_PATH`. That\nmodification is still performed by Git, elsewhere, long after making the\nchanges described above.\n\nWhile we _still_ cannot simply hard-link `mingw64\\bin\\git.exe` to `cmd`\n(because the former depends on a couple of `.dll` files that are only in\n`mingw64\\bin`, i.e. calling `...\\cmd\\git.exe` would fail to load due to\nmissing dependencies), at least we can now avoid that extra process of\nrunning the Git wrapper (which then has to wait for the spawned\n`git.exe` to finish) by calling `...\\mingw64\\bin\\git.exe` directly, via\nits absolute path.\n\nTesting this is in Git's test suite tricky: we set up a \"new\" MSYS\npseudo-root and copy the `git.exe` file into the appropriate location,\nthen verify that `MSYSTEM` is set properly, and also that the `PATH` is\nmodified so that scripts can be found in `$HOME/bin`, `/mingw64/bin/`\nand `/usr/bin/`.\n\nThis addresses https://github.com/git-for-windows/git/issues/2283\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/mingw.c                      | 65 +++++++++++++++++++++++++++++\n config.mak.uname                    |  8 +++-\n contrib/buildsystems/CMakeLists.txt |  9 +++-\n meson.build                         | 15 ++++++-\n meson_options.txt                   |  4 ++\n t/t0060-path-utils.sh               | 30 +++++++++++++\n 6 files changed, 127 insertions(+), 4 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex afdc1ef2db..563e6299bc 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3134,6 +3134,45 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)\n \treturn -1;\n }\n \n+#ifdef ENSURE_MSYSTEM_IS_SET\n+#if !defined(RUNTIME_PREFIX) || !defined(HAVE_WPGMPTR) || !defined(MINGW_PREFIX)\n+static size_t append_system_bin_dirs(char *path UNUSED, size_t size UNUSED)\n+{\n+\treturn 0;\n+}\n+#else\n+static size_t append_system_bin_dirs(char *path, size_t size)\n+{\n+\tchar prefix[32768];\n+\tconst char *slash;\n+\tsize_t len = xwcstoutf(prefix, _wpgmptr, sizeof(prefix)), off = 0;\n+\n+\tif (len == 0 || len >= sizeof(prefix) ||\n+\t    !(slash = find_last_dir_sep(prefix)))\n+\t\treturn 0;\n+\t/* strip trailing `git.exe` */\n+\tlen = slash - prefix;\n+\n+\t/* strip trailing `cmd` or `<mingw-prefix>\\bin` or `bin` or `libexec\\git-core` */\n+\tif (strip_suffix_mem(prefix, &len, \"\\\\\" MINGW_PREFIX \"\\\\libexec\\\\git-core\") ||\n+\t    strip_suffix_mem(prefix, &len, \"\\\\\" MINGW_PREFIX \"\\\\bin\"))\n+\t\toff += xsnprintf(path + off, size - off,\n+\t\t\t\t \"%.*s\\\\\" MINGW_PREFIX \"\\\\bin;\", (int)len, prefix);\n+\telse if (strip_suffix_mem(prefix, &len, \"\\\\cmd\") ||\n+\t\t strip_suffix_mem(prefix, &len, \"\\\\bin\") ||\n+\t\t strip_suffix_mem(prefix, &len, \"\\\\libexec\\\\git-core\"))\n+\t\toff += xsnprintf(path + off, size - off,\n+\t\t\t\t \"%.*s\\\\\" MINGW_PREFIX \"\\\\bin;\", (int)len, prefix);\n+\telse\n+\t\treturn 0;\n+\n+\toff += xsnprintf(path + off, size - off,\n+\t\t\t \"%.*s\\\\usr\\\\bin;\", (int)len, prefix);\n+\treturn off;\n+}\n+#endif\n+#endif\n+\n static void setup_windows_environment(void)\n {\n \tchar *tmp = getenv(\"TMPDIR\");\n@@ -3186,6 +3225,32 @@ static void setup_windows_environment(void)\n \t\t\tsetenv(\"HOME\", tmp, 1);\n \t}\n \n+\tif (!getenv(\"PLINK_PROTOCOL\"))\n+\t\tsetenv(\"PLINK_PROTOCOL\", \"ssh\", 0);\n+\n+#ifdef ENSURE_MSYSTEM_IS_SET\n+\tif (!(tmp = getenv(\"MSYSTEM\")) || !tmp[0]) {\n+\t\tconst char *home = getenv(\"HOME\"), *path = getenv(\"PATH\");\n+\t\tchar buf[32768];\n+\t\tsize_t off = 0;\n+\n+\t\tsetenv(\"MSYSTEM\", ENSURE_MSYSTEM_IS_SET, 1);\n+\n+\t\tif (home)\n+\t\t\toff += xsnprintf(buf + off, sizeof(buf) - off,\n+\t\t\t\t\t \"%s\\\\bin;\", home);\n+\t\toff += append_system_bin_dirs(buf + off, sizeof(buf) - off);\n+\t\tif (path)\n+\t\t\toff += xsnprintf(buf + off, sizeof(buf) - off,\n+\t\t\t\t\t \"%s\", path);\n+\t\telse if (off > 0)\n+\t\t\tbuf[off - 1] = '\\0';\n+\t\telse\n+\t\t\tbuf[0] = '\\0';\n+\t\tsetenv(\"PATH\", buf, 1);\n+\t}\n+#endif\n+\n \tif (!getenv(\"LC_ALL\") && !getenv(\"LC_CTYPE\") && !getenv(\"LANG\"))\n \t\tsetenv(\"LC_CTYPE\", \"C.UTF-8\", 1);\n }\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 2f7d445eb3..0b63be10b7 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -535,7 +535,9 @@ endif\n \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n \t\tcompat/win32/trace2_win32_process_info.o \\\n \t\tcompat/win32/dirent.o\n-\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n+\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY \\\n+\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" -DMINGW_PREFIX=\"\\\"$(patsubst /%,%,$(MINGW_PREFIX))\\\"\" \\\n+\t\t-DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n \tBASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE\n \t# invalidcontinue.obj allows Git's source code to close the same file\n \t# handle twice, or to access the osfhandle of an already-closed stdout\n@@ -758,7 +760,9 @@ ifeq ($(uname_S),MINGW)\n \t\tprefix = $(MINGW_PREFIX)\n \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY\n+\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY \\\n+\t\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" \\\n+\t\t\t-DMINGW_PREFIX=\"\\\"$(patsubst /%,%,$(MINGW_PREFIX))\\\"\"\n                 ifeq (MINGW32,$(MSYSTEM))\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                 endif\ndiff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\nindex a57c4b464f..7285bd9ac2 100644\n--- a/contrib/buildsystems/CMakeLists.txt\n+++ b/contrib/buildsystems/CMakeLists.txt\n@@ -256,7 +256,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n \t\t\t\t_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=\".exe\"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT\n \t\t\t\tNOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0\n \t\t\t\tOVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP\n-\t\t\t\tHAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM)\n+\t\t\t\tHAVE_WPGMPTR HAVE_RTLGENRANDOM)\n+\tif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x64\")\n+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW64\" MINGW_PREFIX=\"mingw64\")\n+\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"arm64\")\n+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"CLANGARM64\" MINGW_PREFIX=\"clangarm64\")\n+\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x86\")\n+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW32\" MINGW_PREFIX=\"mingw32\")\n+\tendif()\n \tlist(APPEND compat_SOURCES\n \t\tcompat/mingw.c\n \t\tcompat/winansi.c\ndiff --git a/meson.build b/meson.build\nindex 7073d5844d..a8aba81e29 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1318,7 +1318,6 @@ elif host_machine.system() == 'windows'\n \n   libgit_c_args += [\n     '-DDETECT_MSYS_TTY',\n-    '-DENSURE_MSYSTEM_IS_SET',\n     '-DNATIVE_CRLF',\n     '-DNOGDI',\n     '-DNO_POSIX_GOODIES',\n@@ -1328,6 +1327,20 @@ elif host_machine.system() == 'windows'\n     '-D__USE_MINGW_ANSI_STDIO=0',\n   ]\n \n+  msystem = get_option('msystem')\n+  if msystem != ''\n+    mingw_prefix = get_option('mingw_prefix')\n+    if mingw_prefix == ''\n+      mingw_prefix = msystem.to_lower()\n+    elif mingw_prefix.startswith('/')\n+      mingw_prefix = mingw_prefix.substring(1)\n+    endif\n+    libgit_c_args += [\n+      '-DENSURE_MSYSTEM_IS_SET=\"' + msystem + '\"',\n+      '-DMINGW_PREFIX=\"' + mingw_prefix + '\"'\n+    ]\n+  endif\n+\n   libgit_dependencies += compiler.find_library('ntdll')\n   libgit_include_directories += 'compat/win32'\n   if compiler.get_id() == 'msvc'\ndiff --git a/meson_options.txt b/meson_options.txt\nindex dc88f130d7..becf4689bf 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -21,6 +21,10 @@ option('runtime_prefix', type: 'boolean', value: false,\n   description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')\n option('sane_tool_path', type: 'array', value: [],\n   description: 'An array of paths to pick up tools from in case the normal tools are broken or lacking.')\n+option('msystem', type: 'string', value: '',\n+  description: 'Fall-back on Windows when MSYSTEM is not set.')\n+option('mingw_prefix', type: 'string', value: '',\n+  description: 'Fall-back on Windows when MINGW_PREFIX is not set.')\n \n # Build information compiled into Git and other parts like documentation.\n option('build_date', type: 'string', value: '',\ndiff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh\nindex 8545cdfab5..02906055d3 100755\n--- a/t/t0060-path-utils.sh\n+++ b/t/t0060-path-utils.sh\n@@ -611,4 +611,34 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works'\n \ttest_cmp expect actual\n '\n \n+test_expect_success MINGW,RUNTIME_PREFIX 'MSYSTEM/PATH is adjusted if necessary' '\n+\tif test -z \"$MINGW_PREFIX\"\n+\tthen\n+\t\tMINGW_PREFIX=\"/$(echo \"${MSYSTEM:-MINGW64}\" | tr A-Z a-z)\"\n+\tfi &&\n+\tmkdir -p \"$HOME\"/bin pretend\"$MINGW_PREFIX\"/bin \\\n+\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core pretend/usr/bin &&\n+\tcp \"$GIT_EXEC_PATH\"/git.exe pretend\"$MINGW_PREFIX\"/bin/ &&\n+\tcp \"$GIT_EXEC_PATH\"/git.exe pretend\"$MINGW_PREFIX\"/libexec/git-core/ &&\n+\t# copy the .dll files, if any (happens when building via CMake)\n+\tif test -n \"$(ls \"$GIT_EXEC_PATH\"/*.dll 2>/dev/null)\"\n+\tthen\n+\t\tcp \"$GIT_EXEC_PATH\"/*.dll pretend\"$MINGW_PREFIX\"/bin/ &&\n+\t\tcp \"$GIT_EXEC_PATH\"/*.dll pretend\"$MINGW_PREFIX\"/libexec/git-core/\n+\tfi &&\n+\techo \"env | grep MSYSTEM=\" | write_script \"$HOME\"/bin/git-test-home &&\n+\techo \"echo ${MINGW_PREFIX#/}\" | write_script pretend\"$MINGW_PREFIX\"/bin/git-test-bin &&\n+\techo \"echo usr\" | write_script pretend/usr/bin/git-test-bin2 &&\n+\n+\t(\n+\t\tMSYSTEM= &&\n+\t\tGIT_EXEC_PATH= &&\n+\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core/git.exe test-home >actual &&\n+\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core/git.exe test-bin >>actual &&\n+\t\tpretend\"$MINGW_PREFIX\"/bin/git.exe test-bin2 >>actual\n+\t) &&\n+\ttest_write_lines MSYSTEM=$MSYSTEM \"${MINGW_PREFIX#/}\" usr >expect &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\n-- \ngitgitgadget\n"},{"id":"552363","messageId":"xmqqik4eqkkq.fsf@gitster.g","threadId":"66125","inReplyTo":"4a4f24a1ba0fce48dce8f77737a5153cf304aa2c.1788981436.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v3 12/12] mingw: allow `git.exe` to be used instead of the \"Git wrapper\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-09-09T19:41:09Z","receivedAt":"2026-09-09T19:41:12Z","isPatch":true,"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n>  t/t0060-path-utils.sh               | 30 +++++++++++++\n\n> diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh\n> index 8545cdfab5..02906055d3 100755\n> --- a/t/t0060-path-utils.sh\n> +++ b/t/t0060-path-utils.sh\n> @@ -611,4 +611,34 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works'\n>  \ttest_cmp expect actual\n>  '\n>  \n> +test_expect_success MINGW,RUNTIME_PREFIX 'MSYSTEM/PATH is adjusted if necessary' '\n> +\tif test -z \"$MINGW_PREFIX\"\n> +\tthen\n> +\t\tMINGW_PREFIX=\"/$(echo \"${MSYSTEM:-MINGW64}\" | tr A-Z a-z)\"\n> +\tfi &&\n> +\tmkdir -p \"$HOME\"/bin pretend\"$MINGW_PREFIX\"/bin \\\n> +\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core pretend/usr/bin &&\n> +\tcp \"$GIT_EXEC_PATH\"/git.exe pretend\"$MINGW_PREFIX\"/bin/ &&\n> +\tcp \"$GIT_EXEC_PATH\"/git.exe pretend\"$MINGW_PREFIX\"/libexec/git-core/ &&\n> +\t# copy the .dll files, if any (happens when building via CMake)\n> +\tif test -n \"$(ls \"$GIT_EXEC_PATH\"/*.dll 2>/dev/null)\"\n> +\tthen\n> +\t\tcp \"$GIT_EXEC_PATH\"/*.dll pretend\"$MINGW_PREFIX\"/bin/ &&\n> +\t\tcp \"$GIT_EXEC_PATH\"/*.dll pretend\"$MINGW_PREFIX\"/libexec/git-core/\n> +\tfi &&\n> +\techo \"env | grep MSYSTEM=\" | write_script \"$HOME\"/bin/git-test-home &&\n> +\techo \"echo ${MINGW_PREFIX#/}\" | write_script pretend\"$MINGW_PREFIX\"/bin/git-test-bin &&\n> +\techo \"echo usr\" | write_script pretend/usr/bin/git-test-bin2 &&\n> +\n> +\t(\n> +\t\tMSYSTEM= &&\n> +\t\tGIT_EXEC_PATH= &&\n> +\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core/git.exe test-home >actual &&\n> +\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core/git.exe test-bin >>actual &&\n> +\t\tpretend\"$MINGW_PREFIX\"/bin/git.exe test-bin2 >>actual\n> +\t) &&\n> +\ttest_write_lines MSYSTEM=$MSYSTEM \"${MINGW_PREFIX#/}\" usr >expect &&\n> +\ttest_cmp expect actual\n> +'\n> +\n>  test_done\n\nThe previous iteration had a \"while at it\" style fix to another test\na few lines back, which is the only difference the end state of this\niteration has relative to the older round.  The movement of part of\n[8/12] to this step is logically correct (even though it does not\nshow in the end state, of course).\n\nShall we mark the topic ready for 'next' by now?\n\nThanks.\n\n\ndiff --git c/t/t0060-path-utils.sh w/t/t0060-path-utils.sh\nindex 56faf5fe73..02906055d3 100755\n--- c/t/t0060-path-utils.sh\n+++ w/t/t0060-path-utils.sh\n@@ -602,8 +602,7 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'RUNTIME_PREFIX wor\n \techo \"echo HERE\" | write_script pretend/libexec/git-core/git-here &&\n \tGIT_EXEC_PATH= ./pretend/bin/git here >actual &&\n \techo HERE >expect &&\n-\ttest_cmp expect actual\n-'\n+\ttest_cmp expect actual'\n \n test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works' '\n \tgit config yes.path \"%(prefix)/yes\" &&\n"},{"id":"552364","messageId":"9f078382-411f-4865-9f01-4fe0b1ee118f@kdbg.org","threadId":"66125","inReplyTo":"4cc14553dcddbd7fb1a49864ae988bad19626391.1788981436.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v3 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2026-09-09T19:47:34Z","receivedAt":"2026-09-09T19:47:51Z","isPatch":true,"body":"Am 09.09.26 um 21:17 schrieb Johannes Schindelin via GitGitGadget:\n> [...]\n> \n> Note: This keeps the same, hard-coded MSYSTEM platform support for CMake\n> as before, but drops it for Meson (because it is unclear how Meson could\n> do this in a more flexible manner).\n\nI think this paragraph is now stale and should be removed from this\ncommit message. I don't know if it makes sense to insert in 12/12, though.\n\n> \n> Helped-by: Junio C Hamano <gitster@pobox.com>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nExcept for this, this is looking good now.\n\n-- Hannes\n\n"},{"id":"552376","messageId":"7ac8168d-5b5f-fec2-ec91-ff72f7b6f1fa@gmx.de","threadId":"66125","inReplyTo":"9f078382-411f-4865-9f01-4fe0b1ee118f@kdbg.org","subject":"Re: [PATCH v3 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2026-09-09T20:13:25Z","receivedAt":"2026-09-09T20:13:27Z","isPatch":true,"body":"Hi Hannes,\n\nOn Wed, 9 Sep 2026, Johannes Sixt wrote:\n\n> Am 09.09.26 um 21:17 schrieb Johannes Schindelin via GitGitGadget:\n> > [...]\n> > \n> > Note: This keeps the same, hard-coded MSYSTEM platform support for CMake\n> > as before, but drops it for Meson (because it is unclear how Meson could\n> > do this in a more flexible manner).\n> \n> I think this paragraph is now stale and should be removed from this\n> commit message. I don't know if it makes sense to insert in 12/12, though.\n\nD'oh, of course! It _was_ unclear to me how Meson could do this, but I\nobviously found a way to support this _somewhat_.\n\n> > \n> > Helped-by: Junio C Hamano <gitster@pobox.com>\n> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> \n> Except for this, this is looking good now.\n\nYes, this should also have a `Helped-by: Johannes Sixt <j6t@kdbg.org>`.\n\nJunio, can you squash those changes before merging to `next`, or do you\nwant me to send another iteration before I go to bed?\n\nCiao,\nJohannes\n\n> \n> -- Hannes\n> \n> \n"},{"id":"552381","messageId":"xmqqik4ep1jp.fsf@gitster.g","threadId":"66125","inReplyTo":"7ac8168d-5b5f-fec2-ec91-ff72f7b6f1fa@gmx.de","subject":"Re: [PATCH v3 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-09-09T21:17:30Z","receivedAt":"2026-09-09T21:17:32Z","isPatch":true,"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Hi Hannes,\n>\n> On Wed, 9 Sep 2026, Johannes Sixt wrote:\n>\n>> Am 09.09.26 um 21:17 schrieb Johannes Schindelin via GitGitGadget:\n>> > [...]\n>> > \n>> > Note: This keeps the same, hard-coded MSYSTEM platform support for CMake\n>> > as before, but drops it for Meson (because it is unclear how Meson could\n>> > do this in a more flexible manner).\n>> \n>> I think this paragraph is now stale and should be removed from this\n>> commit message. I don't know if it makes sense to insert in 12/12, though.\n>\n> D'oh, of course! It _was_ unclear to me how Meson could do this, but I\n> obviously found a way to support this _somewhat_.\n>\n>> > \n>> > Helped-by: Junio C Hamano <gitster@pobox.com>\n>> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n>> \n>> Except for this, this is looking good now.\n>\n> Yes, this should also have a `Helped-by: Johannes Sixt <j6t@kdbg.org>`.\n>\n> Junio, can you squash those changes before merging to `next`, or do you\n> want me to send another iteration before I go to bed?\n\nThose changes meaning removal of the \"Note:\" paragraph from 08/12 or\nanything more elaborate?\n"},{"id":"552397","messageId":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.git.1785939999.gitgitgadget@gmail.com","subject":"[PATCH v4 00/13] Upstream some more Git for Windows' patches","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:14Z","receivedAt":"2026-09-10T06:05:29Z","isPatch":true,"body":"With the imminent switch of Git for Windows from the old MINGW64 environment\n(that was deprecated by MSYS2) to the UCRT64 environment, this patch series\nbecame quite urgent; I will have to work around this patch series not yet\nbeing in master via setup-git-for-windows-sdk to be able to switch without\nbreaking Git's CI builds.\n\nOriginally, I noticed that these patches had not been upstreamed yet when\nrebasing a Git for Windows commit to enable Rust in Windows CI.\n\nChanges since v3:\n\n * Reinstated the fly-by style fix as a separate commit.\n * Added Helped-by trailers\n * Moved and reworded a paragraph from the commit message of 08/12 to 12/12;\n   This should have been done as part of v2.\n\nChanges since v2:\n\n * Moved some hunks that belonged into 12/12 out of 08/12.\n * Dropped a fly-by style cleanup from t0060.\n\nChanges since v1:\n\n * Fixed the meson-side handling of the MINGW_PREFIX constant (this was not\n   noticed in the Git for Windows project because it does not use Meson to\n   build the project).\n\nJohannes Schindelin (13):\n  mingw: include the Python parts in the build\n  mingw: stop hard-coding `CC = gcc`\n  mingw: drop the -D_USE_32BIT_TIME_T option\n  mingw: only use -Wl,--large-address-aware for 32-bit builds\n  mingw: avoid over-specifying `--pic-executable`\n  mingw: set the prefix and HOST_CPU as per MSYS2's settings\n  mingw: only enable the MSYS2-specific stuff when compiling in MSYS2\n  mingw: rely on MSYS2's metadata instead of hard-coding it\n  windows: skip linking `git-<command>` for built-ins\n  mingw: always define `ETC_*` for MSYS2 environments\n  mingw: ensure valid CTYPE\n  mingw: allow `git.exe` to be used instead of the \"Git wrapper\"\n  t0060: adjust the code style\n\n compat/mingw.c                      | 68 +++++++++++++++++++++++++++++\n config.mak.uname                    | 61 ++++++++++++--------------\n contrib/buildsystems/CMakeLists.txt |  9 +++-\n meson.build                         | 15 ++++++-\n meson_options.txt                   |  4 ++\n t/t0060-path-utils.sh               | 33 +++++++++++++-\n 6 files changed, 153 insertions(+), 37 deletions(-)\n\n\nbase-commit: 5b2471720c93ee30e5764a19f3d3b3ae9ec9712a\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2195%2Fdscho%2Fupstream-some-more-git-for-windows-patches-v4\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2195/dscho/upstream-some-more-git-for-windows-patches-v4\nPull-Request: https://github.com/gitgitgadget/git/pull/2195\n\nRange-diff vs v3:\n\n  1:  fd594ffa6c !  1:  0b8ca0e3b9 mingw: include the Python parts in the build\n     @@ Commit message\n          bandwidth), MSYS2 provides very fine Python interpreters that users can\n          easily take advantage of, by using Git for Windows within its SDK.\n      \n     +    Helped-by: Johannes Sixt <j6t@kdbg.org>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## config.mak.uname ##\n  2:  47fc974582 !  2:  9894892ff5 mingw: stop hard-coding `CC = gcc`\n     @@ Commit message\n          This is no longer true in general, not with supporting Clang out of the\n          box.\n      \n     +    Helped-by: Johannes Sixt <j6t@kdbg.org>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## config.mak.uname ##\n  3:  53f1fd5763 !  3:  340dd18f27 mingw: drop the -D_USE_32BIT_TIME_T option\n     @@ Commit message\n      \n          So let's send that option into its well-deserved retirement.\n      \n     +    Helped-by: Johannes Sixt <j6t@kdbg.org>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## config.mak.uname ##\n  4:  ad96aedda6 !  4:  37c6563d74 mingw: only use -Wl,--large-address-aware for 32-bit builds\n     @@ Commit message\n          those builds; UCRT64 versions of GCC, for example, do not know what to\n          do with that option.\n      \n     +    Helped-by: Johannes Sixt <j6t@kdbg.org>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## config.mak.uname ##\n  5:  d67201f9b3 !  5:  0063f2d96a mingw: avoid over-specifying `--pic-executable`\n     @@ Commit message\n      \n          So let's drop the overly-specific definition.\n      \n     +    Helped-by: Johannes Sixt <j6t@kdbg.org>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## config.mak.uname ##\n  6:  b49c42c50d !  6:  e03279a0df mingw: set the prefix and HOST_CPU as per MSYS2's settings\n     @@ Commit message\n          can use those to infer the installation location as well as the CPU. No\n          need for hard-coding ;-)\n      \n     +    Helped-by: Johannes Sixt <j6t@kdbg.org>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## config.mak.uname ##\n  7:  b00d242621 !  7:  29caf78bdd mingw: only enable the MSYS2-specific stuff when compiling in MSYS2\n     @@ Commit message\n          course. In that case, we want to ensure that `MSYSTEM` is set when\n          running `git.exe`, and also enable the magic MSYS2 tty detection.\n      \n     +    Helped-by: Johannes Sixt <j6t@kdbg.org>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## config.mak.uname ##\n  8:  4cc14553dc !  8:  a9665a3304 mingw: rely on MSYS2's metadata instead of hard-coding it\n     @@ Commit message\n          Incidentally, this also broadens the support to all the configurations\n          supported by the MSYS2 project, i.e. clang64 & ucrt64, too.\n      \n     -    Note: This keeps the same, hard-coded MSYSTEM platform support for CMake\n     -    as before, but drops it for Meson (because it is unclear how Meson could\n     -    do this in a more flexible manner).\n     -\n     +    Helped-by: Johannes Sixt <j6t@kdbg.org>\n          Helped-by: Junio C Hamano <gitster@pobox.com>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n  9:  19c600cbee !  9:  0d2990aa14 windows: skip linking `git-<command>` for built-ins\n     @@ Commit message\n          This deprecation was never finalized by skipping these hard-links, but\n          we can start the process now, in Git for Windows.\n      \n     +    Helped-by: Johannes Sixt <j6t@kdbg.org>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## config.mak.uname ##\n 10:  b8cc067e92 ! 10:  b5a78f65b6 mingw: always define `ETC_*` for MSYS2 environments\n     @@ Commit message\n      \n          Special-casing even more configurations simply does not make sense.\n      \n     +    Helped-by: Johannes Sixt <j6t@kdbg.org>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## config.mak.uname ##\n 11:  09c90015fb ! 11:  1bbd0dc6aa mingw: ensure valid CTYPE\n     @@ Commit message\n      \n          This fixes https://github.com/git-for-windows/git/issues/1036\n      \n     +    Helped-by: Johannes Sixt <j6t@kdbg.org>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## compat/mingw.c ##\n 12:  4a4f24a1ba ! 12:  e8115c158c mingw: allow `git.exe` to be used instead of the \"Git wrapper\"\n     @@ Commit message\n      \n          This addresses https://github.com/git-for-windows/git/issues/2283\n      \n     +    Note: This keeps the same, hard-coded MSYSTEM platform support for CMake\n     +    as before, and introduces an `msystem' and `mingw-prefix` knob for Meson\n     +    (read: neither CMake nor Meson will automatically inherit the setting\n     +    from the current build environment).\n     +\n     +    Helped-by: Johannes Sixt <j6t@kdbg.org>\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n       ## compat/mingw.c ##\n  -:  ---------- > 13:  88403ffc9e t0060: adjust the code style\n\n-- \ngitgitgadget\n"},{"id":"552398","messageId":"0b8ca0e3b991eb28dc0cd3a99db8997a73177069.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 01/13] mingw: include the Python parts in the build","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:15Z","receivedAt":"2026-09-10T06:05:30Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWhile Git for Windows does not _ship_ Python (in order to save on\nbandwidth), MSYS2 provides very fine Python interpreters that users can\neasily take advantage of, by using Git for Windows within its SDK.\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 9ebd240378..8dd8acfaa5 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -781,6 +781,7 @@ ifeq ($(uname_S),MINGW)\n \tHAVE_LIBCHARSET_H = YesPlease\n \tUSE_GETTEXT_SCHEME = fallthrough\n \tUSE_LIBPCRE = YesPlease\n+\tNO_PYTHON =\n         ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n \t\t# Move system config into top-level /etc/\n \t\tETC_GITCONFIG = ../etc/gitconfig\n-- \ngitgitgadget\n\n"},{"id":"552399","messageId":"9894892ff590132f875cd2e2bf33bfea4b7edb20.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 02/13] mingw: stop hard-coding `CC = gcc`","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:16Z","receivedAt":"2026-09-10T06:05:32Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThis is no longer true in general, not with supporting Clang out of the\nbox.\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 8dd8acfaa5..a464b2009c 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -771,7 +771,6 @@ ifeq ($(uname_S),MINGW)\n \t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n \t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n         endif\n-\tCC = gcc\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n \t\t-fstack-protector-strong\n \tEXTLIBS += -lntdll\n-- \ngitgitgadget\n\n"},{"id":"552400","messageId":"340dd18f2749812f27fae9ce7dd64cb61b6ba2eb.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 03/13] mingw: drop the -D_USE_32BIT_TIME_T option","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:17Z","receivedAt":"2026-09-10T06:05:33Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThis option was added in fa93bb20d72 (MinGW: Fix stat definitions to\nwork with MinGW runtime version 4.0, 2013-09-11), i.e. a _long_ time\nago. So long, in fact, that it still targeted MinGW. But we switched to\nmingw-w64 in 2015, which seems not to share the problem, and therefore\ndoes not require a fix.\n\nEven worse: This flag is incompatible with UCRT64, which we are about to\nsupport by way of upstreaming `mingw-w64-git` to the MSYS2 project, see\nhttps://github.com/msys2/MINGW-packages/pull/26470 for details.\n\nSo let's send that option into its well-deserved retirement.\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex a464b2009c..cc0ed63af3 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -768,7 +768,6 @@ ifeq ($(uname_S),MINGW)\n \t\tHOST_CPU = aarch64\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n         else\n-\t\tCOMPAT_CFLAGS += -D_USE_32BIT_TIME_T\n \t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n-- \ngitgitgadget\n\n"},{"id":"552401","messageId":"37c6563d7440b066f562de13bdbc174703a75909.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 04/13] mingw: only use -Wl,--large-address-aware for 32-bit builds","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:18Z","receivedAt":"2026-09-10T06:05:35Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThat option only matters there, and is in fact only really understood in\nthose builds; UCRT64 versions of GCC, for example, do not know what to\ndo with that option.\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex cc0ed63af3..b667c693ec 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -757,9 +757,8 @@ ifeq ($(uname_S),MINGW)\n         ifeq (MINGW32,$(MSYSTEM))\n \t\tprefix = /mingw32\n \t\tHOST_CPU = i686\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup\n-        endif\n-        ifeq (MINGW64,$(MSYSTEM))\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup -Wl,--large-address-aware\n+        else ifeq (MINGW64,$(MSYSTEM))\n \t\tprefix = /mingw64\n \t\tHOST_CPU = x86_64\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n@@ -768,7 +767,6 @@ ifeq ($(uname_S),MINGW)\n \t\tHOST_CPU = aarch64\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n         else\n-\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n \t\t-fstack-protector-strong\n-- \ngitgitgadget\n\n"},{"id":"552402","messageId":"0063f2d96a00f0119e67578bcc0b4c8d97ef46e6.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 05/13] mingw: avoid over-specifying `--pic-executable`","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:19Z","receivedAt":"2026-09-10T06:05:36Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIn bf2d5d8239e (Don't let ld strip relocations, 2016-01-16) (picked from\nhttps://github.com/git-for-windows/git/pull/612/commits/6a237925bf10),\nGit for Windows introduced the `-Wl,-pic-executable` flag, specifying\nthe exact entry point via `-e`. This required discerning between i686\nand x86_64 code because the former required the symbol to be prefixed\nwith an underscore, the latter did not.\n\nAs per https://sourceware.org/bugzilla/show_bug.cgi?id=10865, the\nspecified symbols are already the default, though.\n\nSo let's drop the overly-specific definition.\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex b667c693ec..f6387f4c7b 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -757,15 +757,15 @@ ifeq ($(uname_S),MINGW)\n         ifeq (MINGW32,$(MSYSTEM))\n \t\tprefix = /mingw32\n \t\tHOST_CPU = i686\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup -Wl,--large-address-aware\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable -Wl,--large-address-aware\n         else ifeq (MINGW64,$(MSYSTEM))\n \t\tprefix = /mingw64\n \t\tHOST_CPU = x86_64\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable\n         else ifeq (CLANGARM64,$(MSYSTEM))\n \t\tprefix = /clangarm64\n \t\tHOST_CPU = aarch64\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n+\t\tBASIC_LDFLAGS += -Wl,--pic-executable\n         else\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n-- \ngitgitgadget\n\n"},{"id":"552403","messageId":"e03279a0df02d772df112a9ec8ffb9be58485440.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 06/13] mingw: set the prefix and HOST_CPU as per MSYS2's settings","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:20Z","receivedAt":"2026-09-10T06:05:38Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nMSYS2 already defines a couple of helpful environment variables, and we\ncan use those to infer the installation location as well as the CPU. No\nneed for hard-coding ;-)\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 18 ++++++------------\n 1 file changed, 6 insertions(+), 12 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex f6387f4c7b..8363239513 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -754,19 +754,13 @@ ifeq ($(uname_S),MINGW)\n         ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))\n \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n         endif\n-        ifeq (MINGW32,$(MSYSTEM))\n-\t\tprefix = /mingw32\n-\t\tHOST_CPU = i686\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable -Wl,--large-address-aware\n-        else ifeq (MINGW64,$(MSYSTEM))\n-\t\tprefix = /mingw64\n-\t\tHOST_CPU = x86_64\n-\t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-        else ifeq (CLANGARM64,$(MSYSTEM))\n-\t\tprefix = /clangarm64\n-\t\tHOST_CPU = aarch64\n+        ifneq (,$(MSYSTEM))\n+\t\tprefix = $(MINGW_PREFIX)\n+\t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-        else\n+                ifeq (MINGW32,$(MSYSTEM))\n+\t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n+                endif\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n \t\t-fstack-protector-strong\n-- \ngitgitgadget\n\n"},{"id":"552404","messageId":"29caf78bddc914ce610750f6fcd72e4bf10d4a79.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 07/13] mingw: only enable the MSYS2-specific stuff when compiling in MSYS2","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:21Z","receivedAt":"2026-09-10T06:05:39Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe tell-tale is the presence of the `MSYSTEM` value while compiling, of\ncourse. In that case, we want to ensure that `MSYSTEM` is set when\nrunning `git.exe`, and also enable the magic MSYS2 tty detection.\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 8363239513..21f53e3f7e 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -758,12 +758,12 @@ ifeq ($(uname_S),MINGW)\n \t\tprefix = $(MINGW_PREFIX)\n \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n+\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY\n                 ifeq (MINGW32,$(MSYSTEM))\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                 endif\n         endif\n-\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n-\t\t-fstack-protector-strong\n+\tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -fstack-protector-strong\n \tEXTLIBS += -lntdll\n \tEXTRA_PROGRAMS += headless-git$X\n \tINSTALL = /bin/install\n-- \ngitgitgadget\n\n"},{"id":"552405","messageId":"a9665a33041a572139a9dc057b0a60c79eeceaa6.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 08/13] mingw: rely on MSYS2's metadata instead of hard-coding it","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:22Z","receivedAt":"2026-09-10T06:05:40Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nMSYS2 defines some helpful environment variables, e.g. `MSYSTEM`. There\nis code in Git for Windows to ensure that that `MSYSTEM` variable is\nset, hard-coding a default.\n\nHowever, the existing solution jumps through hoops to reconstruct the\nproper default, and is even incomplete doing so, as we found out when we\nextended it to support CLANGARM64.\n\nThis is absolutely unnecessary because there is already a perfectly\nvalid `MSYSTEM` value we can use at build time. This is even true when\nbuilding the MINGW32 variant on a MINGW64 system because `makepkg-mingw`\nwill override the `MSYSTEM` value as per the `MINGW_ARCH` array.\n\nThe same is equally true for the `/mingw64`, `/mingw32` and\n`/clangarm64` prefix: those values are already available via the\n`MINGW_PREFIX` environment variable, and we just need to pass that\nsetting through.\n\nOnly when `MINGW_PREFIX` is not set (as is the case in Git for Windows'\nminimal SDK, where only `MSYSTEM` is guaranteed to be set correctly), we\nuse as fall-back the top-level directory whose name is the down-cased\nvalue of the `MSYSTEM` variable.\n\nIncidentally, this also broadens the support to all the configurations\nsupported by the MSYS2 project, i.e. clang64 & ucrt64, too.\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nHelped-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 14 ++++++--------\n 1 file changed, 6 insertions(+), 8 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 21f53e3f7e..3a90995587 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -465,14 +465,8 @@ ifeq ($(uname_S),Windows)\n \tGIT_VERSION := $(GIT_VERSION).MSVC\n \tpathsep = ;\n \t# Assume that this is built in Git for Windows' SDK\n-        ifeq (MINGW32,$(MSYSTEM))\n-\t\tprefix = /mingw32\n-        else\n-                ifeq (CLANGARM64,$(MSYSTEM))\n-\t\t\tprefix = /clangarm64\n-                else\n-\t\t\tprefix = /mingw64\n-                endif\n+        ifneq (,$(MSYSTEM))\n+\t\tprefix = $(MINGW_PREFIX)\n         endif\n \t# Prepend MSVC 64-bit tool-chain to PATH.\n \t#\n@@ -755,6 +749,10 @@ ifeq ($(uname_S),MINGW)\n \t\tBASIC_LDFLAGS += -Wl,--dynamicbase\n         endif\n         ifneq (,$(MSYSTEM))\n+                ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))\n+\t\t\t# Override if empty or does not start with a slash\n+\t\t\tMINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)\n+                endif\n \t\tprefix = $(MINGW_PREFIX)\n \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-- \ngitgitgadget\n\n"},{"id":"552406","messageId":"0d2990aa147482a743da8fdbe4f9ded2e7fd083d.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 09/13] windows: skip linking `git-<command>` for built-ins","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:23Z","receivedAt":"2026-09-10T06:05:43Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIt is merely a historical wart that, say, `git-commit` exists in the\n`libexec/git-core/` directory, a tribute to the original idea to let Git\nbe essentially a bunch of Unix shell scripts revolving around very few\n\"plumbing\" (AKA low-level) commands.\n\nGit has evolved a lot from there. These days, most of Git's\nfunctionality is contained within the `git` executable, in the form of\n\"built-in\" commands.\n\nTo accommodate for scripts that use the \"dashed\" form of Git commands,\neven today, Git provides hard-links that make the `git` executable\navailable as, say, `git-commit`, just in case that an old script has not\nbeen updated to invoke `git commit`.\n\nThose hard-links do not come cheap: they take about half a minute for\nevery build of Git on Windows, they are mistaken for taking up huge\namounts of space by some Windows Explorer versions that do not\nunderstand hard-links, and therefore many a \"bug\" report had to be\naddressed.\n\nThe \"dashed form\" has been officially deprecated in Git version 1.5.4,\nwhich was released on February 2nd, 2008, i.e. a very long time ago.\nThis deprecation was never finalized by skipping these hard-links, but\nwe can start the process now, in Git for Windows.\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 3a90995587..88bbe1d78f 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -518,6 +518,7 @@ ifeq ($(uname_S),Windows)\n \tNO_POSIX_GOODIES = UnfortunatelyYes\n \tNATIVE_CRLF = YesPlease\n \tDEFAULT_HELP_FORMAT = html\n+\tSKIP_DASHED_BUILT_INS = YabbaDabbaDoo\n ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n \t# Move system config into top-level /etc/\n \tETC_GITCONFIG = ../etc/gitconfig\n@@ -710,6 +711,7 @@ ifeq ($(uname_S),MINGW)\n \tFSMONITOR_DAEMON_BACKEND = win32\n \tFSMONITOR_OS_SETTINGS = win32\n \n+\tSKIP_DASHED_BUILT_INS = YabbaDabbaDoo\n \tRUNTIME_PREFIX = YesPlease\n \tHAVE_WPGMPTR = YesWeDo\n \tNO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease\n-- \ngitgitgadget\n\n"},{"id":"552407","messageId":"b5a78f65b64ea415489f4c8e359636d1bb68bda0.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 10/13] mingw: always define `ETC_*` for MSYS2 environments","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:24Z","receivedAt":"2026-09-10T06:05:44Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nSpecial-casing even more configurations simply does not make sense.\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n config.mak.uname | 10 ++++------\n 1 file changed, 4 insertions(+), 6 deletions(-)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 88bbe1d78f..2f7d445eb3 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -519,7 +519,7 @@ ifeq ($(uname_S),Windows)\n \tNATIVE_CRLF = YesPlease\n \tDEFAULT_HELP_FORMAT = html\n \tSKIP_DASHED_BUILT_INS = YabbaDabbaDoo\n-ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n+ifneq (,$(MINGW_PREFIX))\n \t# Move system config into top-level /etc/\n \tETC_GITCONFIG = ../etc/gitconfig\n \tETC_GITATTRIBUTES = ../etc/gitattributes\n@@ -762,6 +762,9 @@ ifeq ($(uname_S),MINGW)\n                 ifeq (MINGW32,$(MSYSTEM))\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                 endif\n+\t\t# Move system config into top-level /etc/\n+\t\tETC_GITCONFIG = ../etc/gitconfig\n+\t\tETC_GITATTRIBUTES = ../etc/gitattributes\n         endif\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -fstack-protector-strong\n \tEXTLIBS += -lntdll\n@@ -772,11 +775,6 @@ ifeq ($(uname_S),MINGW)\n \tUSE_GETTEXT_SCHEME = fallthrough\n \tUSE_LIBPCRE = YesPlease\n \tNO_PYTHON =\n-        ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))\n-\t\t# Move system config into top-level /etc/\n-\t\tETC_GITCONFIG = ../etc/gitconfig\n-\t\tETC_GITATTRIBUTES = ../etc/gitattributes\n-        endif\n endif\n ifeq ($(uname_S),QNX)\n \tCOMPAT_CFLAGS += -DSA_RESTART=0\n-- \ngitgitgadget\n\n"},{"id":"552408","messageId":"1bbd0dc6aaa362a942d47fc2e4630ca6e7f14cd1.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 11/13] mingw: ensure valid CTYPE","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:25Z","receivedAt":"2026-09-10T06:05:45Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nA change between versions 2.4.1 and 2.6.0 of the MSYS2 runtime modified\nhow Cygwin's runtime (and hence Git for Windows' MSYS2 runtime\nderivative) handles locales: d16a56306d (Consolidate wctomb/mbtowc calls\nfor POSIX-1.2008, 2016-07-20).\n\nAn unintended side-effect is that \"cold-calling\" into the POSIX\nemulation will start with a locale based on the current code page,\nsomething that Git for Windows is very ill-prepared for, as it expects\nto be able to pass a command-line containing non-ASCII characters to the\nshell without having those characters munged.\n\nOne symptom of this behavior: when `git clone` or `git fetch` shell out\nto call `git-upload-pack` with a path that contains non-ASCII\ncharacters, the shell tried to interpret the entire command-line\n(including command-line parameters) as executable path, which obviously\nmust fail.\n\nThis fixes https://github.com/git-for-windows/git/issues/1036\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/mingw.c | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex e0fbd2c66d..afdc1ef2db 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3185,6 +3185,9 @@ static void setup_windows_environment(void)\n \t\tif (!tmp && (tmp = getenv(\"USERPROFILE\")))\n \t\t\tsetenv(\"HOME\", tmp, 1);\n \t}\n+\n+\tif (!getenv(\"LC_ALL\") && !getenv(\"LC_CTYPE\") && !getenv(\"LANG\"))\n+\t\tsetenv(\"LC_CTYPE\", \"C.UTF-8\", 1);\n }\n \n int mingw_platform_has_symlinks(void)\n-- \ngitgitgadget\n\n"},{"id":"552410","messageId":"e8115c158cad58f4a4d59d2572a2c3343c513460.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 12/13] mingw: allow `git.exe` to be used instead of the \"Git wrapper\"","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:26Z","receivedAt":"2026-09-10T06:05:47Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nGit for Windows wants to add `git.exe` to the users' `PATH`, without\ncluttering the latter with unnecessary executables such as `wish.exe`.\nTo that end, it invented the concept of its \"Git wrapper\", i.e. a tiny\nexecutable located in `C:\\Program Files\\Git\\cmd\\git.exe` (originally a\nCMD script) whose sole purpose is to set up a couple of environment\nvariables and then spawn the _actual_ `git.exe` (which nowadays lives in\n`C:\\Program Files\\Git\\mingw64\\bin\\git.exe` for 64-bit, and the obvious\nequivalent for 32-bit installations).\n\nCurrently, the following environment variables are set unless already\ninitialized:\n\n- `MSYSTEM`, to make sure that the MSYS2 Bash and the MSYS2 Perl\n  interpreter behave as expected, and\n\n- `PLINK_PROTOCOL`, to force PuTTY's `plink.exe` to use the SSH\n  protocol instead of Telnet,\n\n- `PATH`, to make sure that the `bin` folder in the user's home\n  directory, as well as the `/mingw64/bin` and the `/usr/bin`\n  directories are included. The trick here is that the `/mingw64/bin/`\n  and `/usr/bin/` directories are relative to the top-level installation\n  directory of Git for Windows (which the included Bash interprets as\n  `/`, i.e. as the MSYS pseudo root directory).\n\nUsing the absence of `MSYSTEM` as a tell-tale, we can detect in\n`git.exe` whether these environment variables have been initialized\nproperly. Therefore we can call `C:\\Program Files\\Git\\mingw64\\bin\\git`\nin-place after this change, without having to call Git through the Git\nwrapper.\n\nObviously, above-mentioned directories must be _prepended_ to the `PATH`\nvariable, otherwise we risk picking up executables from unrelated Git\ninstallations. We do that by constructing the new `PATH` value from\nscratch, appending `$HOME/bin` (if `HOME` is set), then the MSYS2 system\ndirectories, and then appending the original `PATH`.\n\nSide note: this modification of the `PATH` variable is independent of\nthe modification necessary to reach the executables and scripts in\n`/mingw64/libexec/git-core/`, i.e. the `GIT_EXEC_PATH`. That\nmodification is still performed by Git, elsewhere, long after making the\nchanges described above.\n\nWhile we _still_ cannot simply hard-link `mingw64\\bin\\git.exe` to `cmd`\n(because the former depends on a couple of `.dll` files that are only in\n`mingw64\\bin`, i.e. calling `...\\cmd\\git.exe` would fail to load due to\nmissing dependencies), at least we can now avoid that extra process of\nrunning the Git wrapper (which then has to wait for the spawned\n`git.exe` to finish) by calling `...\\mingw64\\bin\\git.exe` directly, via\nits absolute path.\n\nTesting this is in Git's test suite tricky: we set up a \"new\" MSYS\npseudo-root and copy the `git.exe` file into the appropriate location,\nthen verify that `MSYSTEM` is set properly, and also that the `PATH` is\nmodified so that scripts can be found in `$HOME/bin`, `/mingw64/bin/`\nand `/usr/bin/`.\n\nThis addresses https://github.com/git-for-windows/git/issues/2283\n\nNote: This keeps the same, hard-coded MSYSTEM platform support for CMake\nas before, and introduces an `msystem' and `mingw-prefix` knob for Meson\n(read: neither CMake nor Meson will automatically inherit the setting\nfrom the current build environment).\n\nHelped-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n compat/mingw.c                      | 65 +++++++++++++++++++++++++++++\n config.mak.uname                    |  8 +++-\n contrib/buildsystems/CMakeLists.txt |  9 +++-\n meson.build                         | 15 ++++++-\n meson_options.txt                   |  4 ++\n t/t0060-path-utils.sh               | 30 +++++++++++++\n 6 files changed, 127 insertions(+), 4 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex afdc1ef2db..563e6299bc 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3134,6 +3134,45 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)\n \treturn -1;\n }\n \n+#ifdef ENSURE_MSYSTEM_IS_SET\n+#if !defined(RUNTIME_PREFIX) || !defined(HAVE_WPGMPTR) || !defined(MINGW_PREFIX)\n+static size_t append_system_bin_dirs(char *path UNUSED, size_t size UNUSED)\n+{\n+\treturn 0;\n+}\n+#else\n+static size_t append_system_bin_dirs(char *path, size_t size)\n+{\n+\tchar prefix[32768];\n+\tconst char *slash;\n+\tsize_t len = xwcstoutf(prefix, _wpgmptr, sizeof(prefix)), off = 0;\n+\n+\tif (len == 0 || len >= sizeof(prefix) ||\n+\t    !(slash = find_last_dir_sep(prefix)))\n+\t\treturn 0;\n+\t/* strip trailing `git.exe` */\n+\tlen = slash - prefix;\n+\n+\t/* strip trailing `cmd` or `<mingw-prefix>\\bin` or `bin` or `libexec\\git-core` */\n+\tif (strip_suffix_mem(prefix, &len, \"\\\\\" MINGW_PREFIX \"\\\\libexec\\\\git-core\") ||\n+\t    strip_suffix_mem(prefix, &len, \"\\\\\" MINGW_PREFIX \"\\\\bin\"))\n+\t\toff += xsnprintf(path + off, size - off,\n+\t\t\t\t \"%.*s\\\\\" MINGW_PREFIX \"\\\\bin;\", (int)len, prefix);\n+\telse if (strip_suffix_mem(prefix, &len, \"\\\\cmd\") ||\n+\t\t strip_suffix_mem(prefix, &len, \"\\\\bin\") ||\n+\t\t strip_suffix_mem(prefix, &len, \"\\\\libexec\\\\git-core\"))\n+\t\toff += xsnprintf(path + off, size - off,\n+\t\t\t\t \"%.*s\\\\\" MINGW_PREFIX \"\\\\bin;\", (int)len, prefix);\n+\telse\n+\t\treturn 0;\n+\n+\toff += xsnprintf(path + off, size - off,\n+\t\t\t \"%.*s\\\\usr\\\\bin;\", (int)len, prefix);\n+\treturn off;\n+}\n+#endif\n+#endif\n+\n static void setup_windows_environment(void)\n {\n \tchar *tmp = getenv(\"TMPDIR\");\n@@ -3186,6 +3225,32 @@ static void setup_windows_environment(void)\n \t\t\tsetenv(\"HOME\", tmp, 1);\n \t}\n \n+\tif (!getenv(\"PLINK_PROTOCOL\"))\n+\t\tsetenv(\"PLINK_PROTOCOL\", \"ssh\", 0);\n+\n+#ifdef ENSURE_MSYSTEM_IS_SET\n+\tif (!(tmp = getenv(\"MSYSTEM\")) || !tmp[0]) {\n+\t\tconst char *home = getenv(\"HOME\"), *path = getenv(\"PATH\");\n+\t\tchar buf[32768];\n+\t\tsize_t off = 0;\n+\n+\t\tsetenv(\"MSYSTEM\", ENSURE_MSYSTEM_IS_SET, 1);\n+\n+\t\tif (home)\n+\t\t\toff += xsnprintf(buf + off, sizeof(buf) - off,\n+\t\t\t\t\t \"%s\\\\bin;\", home);\n+\t\toff += append_system_bin_dirs(buf + off, sizeof(buf) - off);\n+\t\tif (path)\n+\t\t\toff += xsnprintf(buf + off, sizeof(buf) - off,\n+\t\t\t\t\t \"%s\", path);\n+\t\telse if (off > 0)\n+\t\t\tbuf[off - 1] = '\\0';\n+\t\telse\n+\t\t\tbuf[0] = '\\0';\n+\t\tsetenv(\"PATH\", buf, 1);\n+\t}\n+#endif\n+\n \tif (!getenv(\"LC_ALL\") && !getenv(\"LC_CTYPE\") && !getenv(\"LANG\"))\n \t\tsetenv(\"LC_CTYPE\", \"C.UTF-8\", 1);\n }\ndiff --git a/config.mak.uname b/config.mak.uname\nindex 2f7d445eb3..0b63be10b7 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -535,7 +535,9 @@ endif\n \t\tcompat/win32/pthread.o compat/win32/syslog.o \\\n \t\tcompat/win32/trace2_win32_process_info.o \\\n \t\tcompat/win32/dirent.o\n-\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n+\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY \\\n+\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" -DMINGW_PREFIX=\"\\\"$(patsubst /%,%,$(MINGW_PREFIX))\\\"\" \\\n+\t\t-DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\\\".exe\\\"\n \tBASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE\n \t# invalidcontinue.obj allows Git's source code to close the same file\n \t# handle twice, or to access the osfhandle of an already-closed stdout\n@@ -758,7 +760,9 @@ ifeq ($(uname_S),MINGW)\n \t\tprefix = $(MINGW_PREFIX)\n \t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n-\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY\n+\t\tCOMPAT_CFLAGS += -DDETECT_MSYS_TTY \\\n+\t\t\t-DENSURE_MSYSTEM_IS_SET=\"\\\"$(MSYSTEM)\\\"\" \\\n+\t\t\t-DMINGW_PREFIX=\"\\\"$(patsubst /%,%,$(MINGW_PREFIX))\\\"\"\n                 ifeq (MINGW32,$(MSYSTEM))\n \t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n                 endif\ndiff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\nindex a57c4b464f..7285bd9ac2 100644\n--- a/contrib/buildsystems/CMakeLists.txt\n+++ b/contrib/buildsystems/CMakeLists.txt\n@@ -256,7 +256,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n \t\t\t\t_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=\".exe\"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT\n \t\t\t\tNOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0\n \t\t\t\tOVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP\n-\t\t\t\tHAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM)\n+\t\t\t\tHAVE_WPGMPTR HAVE_RTLGENRANDOM)\n+\tif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x64\")\n+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW64\" MINGW_PREFIX=\"mingw64\")\n+\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"arm64\")\n+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"CLANGARM64\" MINGW_PREFIX=\"clangarm64\")\n+\telseif(CMAKE_GENERATOR_PLATFORM STREQUAL \"x86\")\n+\t\tadd_compile_definitions(ENSURE_MSYSTEM_IS_SET=\"MINGW32\" MINGW_PREFIX=\"mingw32\")\n+\tendif()\n \tlist(APPEND compat_SOURCES\n \t\tcompat/mingw.c\n \t\tcompat/winansi.c\ndiff --git a/meson.build b/meson.build\nindex 7073d5844d..a8aba81e29 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1318,7 +1318,6 @@ elif host_machine.system() == 'windows'\n \n   libgit_c_args += [\n     '-DDETECT_MSYS_TTY',\n-    '-DENSURE_MSYSTEM_IS_SET',\n     '-DNATIVE_CRLF',\n     '-DNOGDI',\n     '-DNO_POSIX_GOODIES',\n@@ -1328,6 +1327,20 @@ elif host_machine.system() == 'windows'\n     '-D__USE_MINGW_ANSI_STDIO=0',\n   ]\n \n+  msystem = get_option('msystem')\n+  if msystem != ''\n+    mingw_prefix = get_option('mingw_prefix')\n+    if mingw_prefix == ''\n+      mingw_prefix = msystem.to_lower()\n+    elif mingw_prefix.startswith('/')\n+      mingw_prefix = mingw_prefix.substring(1)\n+    endif\n+    libgit_c_args += [\n+      '-DENSURE_MSYSTEM_IS_SET=\"' + msystem + '\"',\n+      '-DMINGW_PREFIX=\"' + mingw_prefix + '\"'\n+    ]\n+  endif\n+\n   libgit_dependencies += compiler.find_library('ntdll')\n   libgit_include_directories += 'compat/win32'\n   if compiler.get_id() == 'msvc'\ndiff --git a/meson_options.txt b/meson_options.txt\nindex dc88f130d7..becf4689bf 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -21,6 +21,10 @@ option('runtime_prefix', type: 'boolean', value: false,\n   description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')\n option('sane_tool_path', type: 'array', value: [],\n   description: 'An array of paths to pick up tools from in case the normal tools are broken or lacking.')\n+option('msystem', type: 'string', value: '',\n+  description: 'Fall-back on Windows when MSYSTEM is not set.')\n+option('mingw_prefix', type: 'string', value: '',\n+  description: 'Fall-back on Windows when MINGW_PREFIX is not set.')\n \n # Build information compiled into Git and other parts like documentation.\n option('build_date', type: 'string', value: '',\ndiff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh\nindex 8545cdfab5..02906055d3 100755\n--- a/t/t0060-path-utils.sh\n+++ b/t/t0060-path-utils.sh\n@@ -611,4 +611,34 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works'\n \ttest_cmp expect actual\n '\n \n+test_expect_success MINGW,RUNTIME_PREFIX 'MSYSTEM/PATH is adjusted if necessary' '\n+\tif test -z \"$MINGW_PREFIX\"\n+\tthen\n+\t\tMINGW_PREFIX=\"/$(echo \"${MSYSTEM:-MINGW64}\" | tr A-Z a-z)\"\n+\tfi &&\n+\tmkdir -p \"$HOME\"/bin pretend\"$MINGW_PREFIX\"/bin \\\n+\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core pretend/usr/bin &&\n+\tcp \"$GIT_EXEC_PATH\"/git.exe pretend\"$MINGW_PREFIX\"/bin/ &&\n+\tcp \"$GIT_EXEC_PATH\"/git.exe pretend\"$MINGW_PREFIX\"/libexec/git-core/ &&\n+\t# copy the .dll files, if any (happens when building via CMake)\n+\tif test -n \"$(ls \"$GIT_EXEC_PATH\"/*.dll 2>/dev/null)\"\n+\tthen\n+\t\tcp \"$GIT_EXEC_PATH\"/*.dll pretend\"$MINGW_PREFIX\"/bin/ &&\n+\t\tcp \"$GIT_EXEC_PATH\"/*.dll pretend\"$MINGW_PREFIX\"/libexec/git-core/\n+\tfi &&\n+\techo \"env | grep MSYSTEM=\" | write_script \"$HOME\"/bin/git-test-home &&\n+\techo \"echo ${MINGW_PREFIX#/}\" | write_script pretend\"$MINGW_PREFIX\"/bin/git-test-bin &&\n+\techo \"echo usr\" | write_script pretend/usr/bin/git-test-bin2 &&\n+\n+\t(\n+\t\tMSYSTEM= &&\n+\t\tGIT_EXEC_PATH= &&\n+\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core/git.exe test-home >actual &&\n+\t\tpretend\"$MINGW_PREFIX\"/libexec/git-core/git.exe test-bin >>actual &&\n+\t\tpretend\"$MINGW_PREFIX\"/bin/git.exe test-bin2 >>actual\n+\t) &&\n+\ttest_write_lines MSYSTEM=$MSYSTEM \"${MINGW_PREFIX#/}\" usr >expect &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\n-- \ngitgitgadget\n\n"},{"id":"552409","messageId":"88403ffc9ea5c3cba4c410d80efbbc36becefa0d.1789020327.git.gitgitgadget@gmail.com","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"[PATCH v4 13/13] t0060: adjust the code style","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-09-10T06:05:27Z","receivedAt":"2026-09-10T06:05:48Z","isPatch":true,"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThese days, the test cases are less free-form than in the wild old days\nof the Git project.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/t0060-path-utils.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh\nindex 02906055d3..56faf5fe73 100755\n--- a/t/t0060-path-utils.sh\n+++ b/t/t0060-path-utils.sh\n@@ -602,7 +602,8 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'RUNTIME_PREFIX wor\n \techo \"echo HERE\" | write_script pretend/libexec/git-core/git-here &&\n \tGIT_EXEC_PATH= ./pretend/bin/git here >actual &&\n \techo HERE >expect &&\n-\ttest_cmp expect actual'\n+\ttest_cmp expect actual\n+'\n \n test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works' '\n \tgit config yes.path \"%(prefix)/yes\" &&\n-- \ngitgitgadget\n"},{"id":"552441","messageId":"xmqqbja5gth9.fsf@gitster.g","threadId":"66125","inReplyTo":"pull.2195.v4.git.1789020327.gitgitgadget@gmail.com","subject":"Re: [PATCH v4 00/13] Upstream some more Git for Windows' patches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-09-10T12:51:14Z","receivedAt":"2026-09-10T12:51:17Z","isPatch":true,"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> Originally, I noticed that these patches had not been upstreamed yet when\n> rebasing a Git for Windows commit to enable Rust in Windows CI.\n>\n> Changes since v3:\n>\n>  * Reinstated the fly-by style fix as a separate commit.\n>  * Added Helped-by trailers\n>  * Moved and reworded a paragraph from the commit message of 08/12 to 12/12;\n>    This should have been done as part of v2.\n\nHaving a reroll by the author makes my life easier ;-) Will replace,\nand with J6t's earlier blessing, we can mark it for 'next'.\n\nThanks, both.\n"},{"id":"552538","messageId":"aqQAjiFQlY_ti4f4@ugly.lan","threadId":"66125","inReplyTo":"37c6563d7440b066f562de13bdbc174703a75909.1789020327.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v4 04/13] mingw: only use -Wl,--large-address-aware for 32-bit builds","fromName":"Oswald Buddenhagen","fromEmail":"oswald.buddenhagen@gmx.de","sentAt":"2026-09-11T13:22:22Z","receivedAt":"2026-09-11T13:22:24Z","isPatch":true,"body":"On Thu, Sep 10, 2026 at 06:05:18AM +0000, Johannes Schindelin via GitGitGadget wrote:\n>+++ b/config.mak.uname\n>@@ -768,7 +767,6 @@ ifeq ($(uname_S),MINGW)\n> \t\tHOST_CPU = aarch64\n> \t\tBASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup\n>         else\n>-\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n>         endif\n>\nyou're apparently leaving an empty else branch behind. that looks weird.\n\n"},{"id":"552539","messageId":"aqQBiGCuZFiafnlJ@ugly.lan","threadId":"66125","inReplyTo":"e03279a0df02d772df112a9ec8ffb9be58485440.1789020327.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v4 06/13] mingw: set the prefix and HOST_CPU as per MSYS2's settings","fromName":"Oswald Buddenhagen","fromEmail":"oswald.buddenhagen@gmx.de","sentAt":"2026-09-11T13:26:32Z","receivedAt":"2026-09-11T13:26:35Z","isPatch":true,"body":"On Thu, Sep 10, 2026 at 06:05:20AM +0000, Johannes Schindelin via GitGitGadget wrote:\n>+++ b/config.mak.uname\n>@@ -754,19 +754,13 @@ ifeq ($(uname_S),MINGW)\n>+        ifneq (,$(MSYSTEM))\n>+\t\tprefix = $(MINGW_PREFIX)\n>+\t\tHOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))\n> \t\tBASIC_LDFLAGS += -Wl,--pic-executable\n>-        else\n>+                ifeq (MINGW32,$(MSYSTEM))\n>+\t\t\tBASIC_LDFLAGS += -Wl,--large-address-aware\n>+                endif\n>         endif\n> \tCOMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \\\n> \t\t-fstack-protector-strong\n>\nthis kinda worsens the unholy tab-space-mix in this file. tabs would \nseem like the lesser evil in this place.\n"}]}