Re: [PATCH 12/12] mingw: allow `git.exe` to be used instead of the "Git wrapper"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 6, 2026, 17:26 UTC
- Message-ID
- <xmqq33wrkvmu.fsf@gitster.g>
- In-Reply-To
- <f822133191c9cca40477fb1bdd5d1416c9fe66c1.1785939999.git.gitgitgadget@gmail.com>
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 9 quoted lines
> @@ -3186,6 +3225,32 @@ static void setup_windows_environment(void)
> setenv("HOME", tmp, 1);
> }
>
> + if (!getenv("PLINK_PROTOCOL"))
> + setenv("PLINK_PROTOCOL", "ssh", 0);
> +
> +#ifdef ENSURE_MSYSTEM_IS_SET
> + if (!(tmp = getenv("MSYSTEM")) || !tmp[0]) {Checking tmp[0] is a sign that we do not consider MSYSTEM set to an empty string a sane state and ENSURE_MSYSTEM_IS_SET is about correcting it, right?
Show 5 quoted lines
> + const char *home = getenv("HOME"), *path = getenv("PATH");
> + char buf[32768];
> + size_t off = 0;
> +
> + setenv("MSYSTEM", ENSURE_MSYSTEM_IS_SET, 1);In config.mak.uname, ENSURE_MSYSTEM_IS_SET is defined to "$(MSYSTEM)".
+ COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY \ + -DENSURE_MSYSTEM_IS_SET="\"$(MSYSTEM)\"" -DMINGW_PREFIX="\"$(patsubst /%,%,$(MINGW_PREFIX))\"" \
Can $(MSYSTEM) be an empty string or undefined at the build time, making ENSURE_MSYSTEM_IS_SET set to "" (two double-quotes)? Which would mean we are exporting MSYSTEM defined to be an empty string as well with this setenv.
It seems ifeq($(uname_S),MINGW) side protects against this situation by placing the cflags definition + COMPAT_CFLAGS += -DDETECT_MSYS_TTY \ + -DENSURE_MSYSTEM_IS_SET="\"$(MSYSTEM)\"" \
inside "ifneq (,$(MSYSTEM))..endif". That way, ENSURE_MSYSTEM_IS_SET is not defined to "" (two double-quotes), so #ifdef ENSURE_MSYSTEM_IS_SET would not kick in.