diff --git a/compat/mingw.c b/compat/mingw.c index 2dce8c81e3..4cfa7d3ce4 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -2233,6 +2233,18 @@ void mingw_startup() environ[i] = xstrdup(to_free + 6); free(to_free); } + if (starts_with(environ[i], "TMP=")) { + /* + * Convert all dir separators to forward slashes, + * to help shell commands called from the Git + * executable (by not mistaking the dir separators + * for escape characters. + */ + char *p; + for (p = environ[i]; *p; p++) + if (*p == '\\') + *p = '/'; + } } environ[i] = NULL; free(buffer);