Some git tools such as GitExtensions for Windows use environment variable 
TERM=msys which causes the weird ANSI sequence shown for the messages returned 
from server-side hooks
We add those ANSI sequences to help format sideband data on the user's 
terminal. However, GitExtensions is not using a terminal, and the ANSI 
sequences just confuses it. We can recognize this use by checking isatty().
See for more details

NOTE: I considered to cover the case that a pager has already been started. But 
decided that is probably not worth worrying about here, though, as we shouldn't 
be using a pager for commands that do network communications (and if we do, 
omitting the magic line-clearing signal is probably a sane thing to do).

Signed-off-by: Michael Naumov <>
Thanks-to: Erik Faye-Lund <>
Thanks-to: Jeff King <>
 sideband.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sideband.c b/sideband.c
index d1125f5..7f9dc22 100644
--- a/sideband.c
+++ b/sideband.c
@@ -30,7 +30,7 @@ int recv_sideband(const char *me, int in_stream, int out)
        memcpy(buf, PREFIX, pf);
        term = getenv("TERM");
-       if (term && strcmp(term, "dumb"))
+       if (isatty(2) && term && strcmp(term, "dumb"))
                suffix = ANSI_SUFFIX;
                suffix = DUMB_SUFFIX;

P.S. I gave up trying to send this letter from gmail, it eats my tab character
P.S 2. Sorry, my tab character has been eaten again!

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to