mirror of
https://github.com/git/git.git
synced 2026-01-23 09:01:15 +00:00
Enable color output in Windows cmd.exe
Git requires the TERM environment variable to be set for all color* settings. Simulate the TERM variable if it is not set (default on Windows). Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Pat Thoyts
parent
364a83ca51
commit
5860fad896
@@ -668,11 +668,16 @@ char *mingw_getcwd(char *pointer, int len)
|
||||
char *mingw_getenv(const char *name)
|
||||
{
|
||||
char *result = getenv(name);
|
||||
if (!result && !strcmp(name, "TMPDIR")) {
|
||||
/* on Windows it is TMP and TEMP */
|
||||
result = getenv("TMP");
|
||||
if (!result)
|
||||
result = getenv("TEMP");
|
||||
if (!result) {
|
||||
if (!strcmp(name, "TMPDIR")) {
|
||||
/* on Windows it is TMP and TEMP */
|
||||
result = getenv("TMP");
|
||||
if (!result)
|
||||
result = getenv("TEMP");
|
||||
} else if (!strcmp(name, "TERM")) {
|
||||
/* simulate TERM to enable auto-color (see color.c) */
|
||||
result = "winansi";
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user