From e5442cdce9442e2cc75269bcc41d016f6b49fdc2 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 10 Jan 2017 12:53:34 +0100 Subject: [PATCH] Revert "Merge 'mingw-isatty' into HEAD" Prepare to merge the latest iteration of the mingw-isatty patch series. This reverts commit 4af28e2fb4af1069c81a3dcfab0332498e8424de, reversing changes made to 6cd98a7c65ea69403c288adb00b0d883319fd2a5. Signed-off-by: Johannes Schindelin --- compat/mingw.h | 3 --- compat/winansi.c | 33 --------------------------------- 2 files changed, 36 deletions(-) diff --git a/compat/mingw.h b/compat/mingw.h index 377b437367..20731cd709 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -472,9 +472,6 @@ int mingw_raise(int sig); * ANSI emulation wrappers */ -int winansi_isatty(int fd); -#define isatty winansi_isatty - void winansi_init(void); HANDLE winansi_get_osfhandle(int fd); diff --git a/compat/winansi.c b/compat/winansi.c index cb51ffedb8..64d47e1141 100644 --- a/compat/winansi.c +++ b/compat/winansi.c @@ -24,9 +24,6 @@ static void set_interactive(int fd, int bit) #endif -/* In this file, we actually want to use Windows' own isatty(). */ -#undef isatty - /* ANSI codes used by git: m, K @@ -663,36 +660,6 @@ static void detect_msys_tty(int fd) #endif -int winansi_isatty(int fd) -{ - int res = isatty(fd); - - if (res) { - /* - * Make sure that /dev/null is not fooling Git into believing - * that we are connected to a terminal, as "_isatty() returns a - * nonzero value if the descriptor is associated with a - * character device."; for more information, see - * - * https://msdn.microsoft.com/en-us/library/f4s0ddew.aspx - */ - HANDLE handle = (HANDLE)_get_osfhandle(fd); - if (fd == STDIN_FILENO) { - DWORD dummy; - - if (!GetConsoleMode(handle, &dummy)) - res = 0; - } else if (fd == STDOUT_FILENO || fd == STDERR_FILENO) { - CONSOLE_SCREEN_BUFFER_INFO dummy; - - if (!GetConsoleScreenBufferInfo(handle, &dummy)) - res = 0; - } - } - - return res; -} - void winansi_init(void) { int con1, con2;