Win32: enable color output in Windows cmd.exe
authorKarsten Blees <blees@dcon.de>
Thu, 17 Jul 2014 15:38:06 +0000 (17:38 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Jul 2014 16:32:50 +0000 (09:32 -0700)
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>
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw.c
index 74c6180a201edc578b477ced6557963ce89d1116..df0fa03194aa696b91132094dd32abb54fdf7cd4 100644 (file)
@@ -2113,6 +2113,10 @@ void mingw_startup()
                        setenv("TMPDIR", tmp, 1);
        }
 
+       /* simulate TERM to enable auto-color (see color.c) */
+       if (!getenv("TERM"))
+               setenv("TERM", "cygwin", 1);
+
        /* initialize critical section for waitpid pinfo_t list */
        InitializeCriticalSection(&pinfo_cs);