mirror of
https://github.com/git/git.git
synced 2026-01-27 02:48:32 +00:00
winansi.c: Fix colourization on Cygwin pseudo terminals.
Git only colours the output and uses pagination if isatty() returns 1.
MSys and Cygwin emulate pseudo terminals via named pipes, meaning that
isatty() returns 0.
Commit 3adef8de55 fixed this for MSys
terminals, but not Cygwin.
The named pipes that Cygwin and Msys use are very similar. MSys PTY pipes
are called 'msys-*-pty*' and Cygwin uses 'cygwin-*-pty*'. This commit
modifies the existing check to allow both MSys and Cygwin PTY pipes to be
identified as TTYs.
Note that Pagination is still broken on Cygwin. less.exe is spawned (as
seen in Process Explorer and using GIT_TRACE=1), but the output is not
being piped into it.
This partially fixes https://github.com/git-for-windows/git/issues/267
Signed-off-by: Alan Davies <alan.n.davies@gmail.com>
This commit is contained in:
committed by
Johannes Schindelin
parent
1b47e5f6fe
commit
4e0f44c889
@@ -555,8 +555,12 @@ static void detect_msys_tty(int fd)
|
||||
name = nameinfo->Name.Buffer;
|
||||
name[nameinfo->Name.Length] = 0;
|
||||
|
||||
/* check if this could be a MSYS2 pty pipe ('msys-XXXX-ptyN-XX') */
|
||||
if (!wcsstr(name, L"msys-") || !wcsstr(name, L"-pty"))
|
||||
/*
|
||||
* Check if this could be a MSYS2 pty pipe ('msys-XXXX-ptyN-XX')
|
||||
* or a cygwin pty pipe ('cygwin-XXXX-ptyN-XX')
|
||||
*/
|
||||
if ((!wcsstr(name, L"msys-") && !wcsstr(name, L"cygwin-")) ||
|
||||
!wcsstr(name, L"-pty"))
|
||||
return;
|
||||
|
||||
/* init ioinfo size if we haven't done so */
|
||||
|
||||
Reference in New Issue
Block a user