Skip to content

Commit 1963c5b

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 defc354 commit 1963c5b

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
@@ -2219,8 +2219,14 @@ void mingw_startup()
22192219
__argv[0] = wcstoutfdup_startup(buffer, _wpgmptr, maxlen);
22202220
for (i = 1; i < argc; i++)
22212221
__argv[i] = wcstoutfdup_startup(buffer, wargv[i], maxlen);
2222-
for (i = 0; wenv[i]; i++)
2222+
for (i = 0; wenv[i]; i++) {
22232223
environ[i] = wcstoutfdup_startup(buffer, wenv[i], maxlen);
2224+
if (!strncasecmp(environ[i], "MSYS2_TZ=", 9)) {
2225+
char *to_free = environ[i];
2226+
environ[i] = xstrdup(to_free + 6);
2227+
free(to_free);
2228+
}
2229+
}
22242230
environ[i] = NULL;
22252231
free(buffer);
22262232

0 commit comments

Comments
 (0)