From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH 12/12] mingw: allow `git.exe` to be used instead of the "Git wrapper"
Date: Wed, 12 Aug 2026 09:51:21 +0200 (CEST) [thread overview]
Message-ID: <bacfe6f4-706e-670c-3466-ccb4d7caeffb@gmx.de> (raw)
In-Reply-To: <xmqq33wrkvmu.fsf@gitster.g>
Hi Junio,
On Thu, 6 Aug 2026, Junio C Hamano wrote:
> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> 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.
>
>
next prev parent reply other threads:[~2026-08-12 7:51 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 14:26 [PATCH 00/12] Upstream some more Git for Windows' patches Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 01/12] mingw: include the Python parts in the build Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 02/12] mingw: stop hard-coding `CC = gcc` Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 03/12] mingw: drop the -D_USE_32BIT_TIME_T option Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 04/12] mingw: only use -Wl,--large-address-aware for 32-bit builds Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 05/12] mingw: avoid over-specifying `--pic-executable` Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 06/12] mingw: set the prefix and HOST_CPU as per MSYS2's settings Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 07/12] mingw: only enable the MSYS2-specific stuff when compiling in MSYS2 Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it Johannes Schindelin via GitGitGadget
2026-08-05 17:29 ` Junio C Hamano
2026-08-06 12:50 ` Johannes Schindelin
2026-08-05 14:26 ` [PATCH 09/12] windows: skip linking `git-<command>` for built-ins Johannes Schindelin via GitGitGadget
2026-08-05 17:12 ` Junio C Hamano
2026-08-05 14:26 ` [PATCH 10/12] mingw: always define `ETC_*` for MSYS2 environments Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 11/12] mingw: ensure valid CTYPE Johannes Schindelin via GitGitGadget
2026-08-05 14:26 ` [PATCH 12/12] mingw: allow `git.exe` to be used instead of the "Git wrapper" Johannes Schindelin via GitGitGadget
2026-08-06 17:26 ` Junio C Hamano
2026-08-12 7:51 ` Johannes Schindelin [this message]
2026-08-12 7:52 ` [PATCH v2 00/12] Upstream some more Git for Windows' patches Johannes Schindelin via GitGitGadget
2026-08-12 7:52 ` [PATCH v2 01/12] mingw: include the Python parts in the build Johannes Schindelin via GitGitGadget
2026-08-12 7:52 ` [PATCH v2 02/12] mingw: stop hard-coding `CC = gcc` Johannes Schindelin via GitGitGadget
2026-08-12 7:52 ` [PATCH v2 03/12] mingw: drop the -D_USE_32BIT_TIME_T option Johannes Schindelin via GitGitGadget
2026-08-12 7:52 ` [PATCH v2 04/12] mingw: only use -Wl,--large-address-aware for 32-bit builds Johannes Schindelin via GitGitGadget
2026-08-12 7:52 ` [PATCH v2 05/12] mingw: avoid over-specifying `--pic-executable` Johannes Schindelin via GitGitGadget
2026-08-12 7:52 ` [PATCH v2 06/12] mingw: set the prefix and HOST_CPU as per MSYS2's settings Johannes Schindelin via GitGitGadget
2026-08-12 7:52 ` [PATCH v2 07/12] mingw: only enable the MSYS2-specific stuff when compiling in MSYS2 Johannes Schindelin via GitGitGadget
2026-08-12 7:52 ` [PATCH v2 08/12] mingw: rely on MSYS2's metadata instead of hard-coding it Johannes Schindelin via GitGitGadget
2026-08-12 7:52 ` [PATCH v2 09/12] windows: skip linking `git-<command>` for built-ins Johannes Schindelin via GitGitGadget
2026-08-12 7:52 ` [PATCH v2 10/12] mingw: always define `ETC_*` for MSYS2 environments Johannes Schindelin via GitGitGadget
2026-08-12 7:52 ` [PATCH v2 11/12] mingw: ensure valid CTYPE Johannes Schindelin via GitGitGadget
2026-08-12 7:52 ` [PATCH v2 12/12] mingw: allow `git.exe` to be used instead of the "Git wrapper" Johannes Schindelin via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bacfe6f4-706e-670c-3466-ccb4d7caeffb@gmx.de \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox