Skip to content

Commit a629f48

Browse files
dschonalla
authored andcommitted
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 53c9de9 commit a629f48

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
@@ -2103,8 +2103,14 @@ void mingw_startup()
21032103
__argv[0] = wcstoutfdup_startup(buffer, _wpgmptr, maxlen);
21042104
for (i = 1; i < argc; i++)
21052105
__argv[i] = wcstoutfdup_startup(buffer, wargv[i], maxlen);
2106-
for (i = 0; wenv[i]; i++)
2106+
for (i = 0; wenv[i]; i++) {
21072107
environ[i] = wcstoutfdup_startup(buffer, wenv[i], maxlen);
2108+
if (!strncasecmp(environ[i], "MSYS2_TZ=", 9)) {
2109+
char *to_free = environ[i];
2110+
environ[i] = xstrdup(to_free + 6);
2111+
free(to_free);
2112+
}
2113+
}
21082114
environ[i] = NULL;
21092115
free(buffer);
21102116

0 commit comments

Comments
 (0)