]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'js/mingw-isatty'
authorJunio C Hamano <gitster@pobox.com>
Tue, 27 Dec 2016 08:11:46 +0000 (00:11 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 Dec 2016 08:11:46 +0000 (00:11 -0800)
Update the isatty() emulation for Windows by updating the previous
hack that depended on internals of (older) MSVC runtime.

* js/mingw-isatty:
  mingw: replace isatty() hack
  mingw: fix colourization on Cygwin pseudo terminals
  mingw: adjust is_console() to work with stdin

1  2 
compat/winansi.c

index 97d84a96ededd9446ad409db2a410f9a03879e9b,477209fce7beedca3159a8140d2ac9e3a69400f3..3c9ed3cfe07c1f3b58f5400af861fb8ae44c3fdb
@@@ -556,19 -540,17 +540,17 @@@ static void detect_msys_tty(int fd
                        buffer, sizeof(buffer) - 2, &result)))
                return;
        name = nameinfo->Name.Buffer;
 -      name[nameinfo->Name.Length] = 0;
 +      name[nameinfo->Name.Length / sizeof(*name)] = 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 */
-       if (init_sizeof_ioinfo())
-               return;
-       /* set FDEV flag, reset FPIPE flag */
-       _pioinfo(fd)->osflags &= ~FPIPE;
-       _pioinfo(fd)->osflags |= FDEV;
+       fd_is_interactive[fd] |= FD_MSYS;
  }
  
  #endif