Re: [PATCH] winansi_isatty(): fix when Git is used from CMD

2016-12-22 Thread Johannes Schindelin
Hi Junio, On Wed, 21 Dec 2016, Junio C Hamano wrote: > Johannes Schindelin writes: > > > I prepared a patch series based on `pu`, on top of Hannes' patch, and > > I also prepared a branch that is based on `master`, obviously without > > Hannes' patch. > > I think

Re: [PATCH] winansi_isatty(): fix when Git is used from CMD

2016-12-21 Thread Junio C Hamano
Johannes Schindelin writes: > I prepared a patch series based on `pu`, on top of Hannes' patch, and I > also prepared a branch that is based on `master`, obviously without > Hannes' patch. I think the latter is what you have at $ git fetch

Re: [PATCH] winansi_isatty(): fix when Git is used from CMD

2016-12-21 Thread Johannes Schindelin
Hi Junio, On Tue, 20 Dec 2016, Junio C Hamano wrote: > Johannes Schindelin writes: > > > That code works because winansi_get_osfhandle() is in winansi.c, where its > > call to isatty() is *not* redirected to winansi_isatty(). Good. > > ... > > My plan was actually

Re: [PATCH] winansi_isatty(): fix when Git is used from CMD

2016-12-21 Thread Johannes Schindelin
Hi Hannes, On Mon, 19 Dec 2016, Johannes Sixt wrote: > Am 18.12.2016 um 16:37 schrieb Johannes Sixt: > > winansi.c is all about overriding MSVCRT's console handling. If we are > > connected to a console, then by the time isatty() is called (from > > outside the emulation layer), all handling of

Re: [PATCH] winansi_isatty(): fix when Git is used from CMD

2016-12-20 Thread Junio C Hamano
Johannes Schindelin writes: > That code works because winansi_get_osfhandle() is in winansi.c, where its > call to isatty() is *not* redirected to winansi_isatty(). Good. > ... > My plan was actually ... > ... > Let's just clean up all of this in one go. I take this

Re: [PATCH] winansi_isatty(): fix when Git is used from CMD

2016-12-20 Thread Johannes Schindelin
Hi Hannes, On Sun, 18 Dec 2016, Johannes Sixt wrote: > What do you think? > > diff --git a/compat/winansi.c b/compat/winansi.c > index ba360be69b..1748d1 100644 > --- a/compat/winansi.c > +++ b/compat/winansi.c > @@ -575,9 +575,8 @@ static void detect_msys_tty(int fd) > > int

Re: [PATCH] winansi_isatty(): fix when Git is used from CMD

2016-12-20 Thread Johannes Schindelin
Hi Hannes, On Sun, 18 Dec 2016, Johannes Sixt wrote: > The code in winansi.c emulates ANSI escape sequences when Git is > connected to the "real" windows console, CMD.exe. The details are > outline in eac14f8909d9 (Win32: Thread-safe windows console output, > 2012-01-14). Essentially, it plugs a

Re: [PATCH] winansi_isatty(): fix when Git is used from CMD

2016-12-19 Thread Johannes Sixt
Am 18.12.2016 um 16:37 schrieb Johannes Sixt: winansi.c is all about overriding MSVCRT's console handling. If we are connected to a console, then by the time isatty() is called (from outside the emulation layer), all handling of file descriptors 1 and 2 is already outside MSVCRT's control. In

Re: [PATCH] winansi_isatty(): fix when Git is used from CMD

2016-12-18 Thread Junio C Hamano
Johannes Sixt writes: > .. > The new isatty() override implemented by cbb3f3c9b197 (mingw: intercept > isatty() to handle /dev/null as Git expects it, 2016-12-11) does not > take into account that _get_osfhandle() returns the handle visible by > the C code, which is the pipe. But

Re: [PATCH] winansi_isatty(): fix when Git is used from CMD

2016-12-18 Thread Johannes Sixt
Am 18.12.2016 um 16:26 schrieb Johannes Sixt: > The new isatty() override implemented by cbb3f3c9b197 (mingw: intercept > isatty() to handle /dev/null as Git expects it, 2016-12-11) does not > take into account that _get_osfhandle() returns the handle visible by > the C code, which is the pipe.

[PATCH] winansi_isatty(): fix when Git is used from CMD

2016-12-18 Thread Johannes Sixt
The code in winansi.c emulates ANSI escape sequences when Git is connected to the "real" windows console, CMD.exe. The details are outline in eac14f8909d9 (Win32: Thread-safe windows console output, 2012-01-14). Essentially, it plugs a pipe between C code and the actual console output handle.