Re: [PATCH 12/12] mingw: allow `git.exe` to be used instead of the "Git wrapper"
Johannes Schindelin <[email protected]>
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
Hi Junio, On Thu, 6 Aug 2026, Junio C Hamano wrote: > "Johannes Schindelin via GitGitGadget" <[email protected]> > writes: > > > @@ -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? "sane state" is quite the strong wording for such a minor issue. The MSYSTEM variable is useful as an indicator, and is therefore used in many scripts. Git itself only uses it as a tell-tale that a GUI should be used in `git bisect visualize`, otherwise Git is totally fine with empty or even non-sensical values. But it _is_ a convenient thing to have, together with `MINGW_PREFIX` to ensure that the respective `/*/bin/` directories are prepended to the `PATH` variable. That's what this is all about. > > > + 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)? Sure it can. Just like `PATH` or `HOME` can be empty, or invalid. But the person building the project has to go out of their way to make it so, therefore I don't want to spend any more brain cells on that highly unlikely scenario. Ciao, Johannes > 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. > >