mirror of
https://github.com/git-for-windows/git.git
synced 2026-03-23 07:32:01 -05:00
mingw: Prepare the TMP environment variable for shell scripts
When shell scripts access a $TMP variable containing backslashes, they will be mistaken for escape characters. Let's not let that happen by converting them to forward slashes. This fixes t7800 with MSys2. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user