Skip to content

Commit fb3ca79

Browse files
committed
Special-case the MSYS2_TZ environment variable
With MSys2, the "TZ" environment variable gets filtered out when calling non-MSys2 executables. The reason is that Windows' time zone handling is substantially different from the POSIX one. However, we just taught Git for Windows' fork of the MSys2 runtime to pass on the timezone in a different environment variable, MSYS2_TZ for the sole purpose of Git being able to reinterpret it correctly. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent ad5d003 commit fb3ca79

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compat/mingw.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2226,8 +2226,14 @@ void mingw_startup()
22262226
__argv[0] = wcstoutfdup_startup(buffer, _wpgmptr, maxlen);
22272227
for (i = 1; i < argc; i++)
22282228
__argv[i] = wcstoutfdup_startup(buffer, wargv[i], maxlen);
2229-
for (i = 0; wenv[i]; i++)
2229+
for (i = 0; wenv[i]; i++) {
22302230
environ[i] = wcstoutfdup_startup(buffer, wenv[i], maxlen);
2231+
if (starts_with(environ[i], "MSYS2_TZ=")) {
2232+
char *to_free = environ[i];
2233+
environ[i] = xstrdup(to_free + 6);
2234+
free(to_free);
2235+
}
2236+
}
22312237
environ[i] = NULL;
22322238
free(buffer);
22332239

0 commit comments

Comments
 (0)