{"thread":{"id":"36764","subject":"Re: [PATCH] sideband.c: Get rid of ANSI sequence for non-terminal shell","startedAt":"2014-05-27T16:47:25Z","lastAt":"2014-05-27T16:47:25Z","messageCount":1,"participants":["Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"242751","messageId":"20140527164725.GC29693@sigill.intra.peff.net","threadId":"36764","inReplyTo":"CABHRWd2-FHL+ZUf7Fp8WnC4Vj4_5=k__huFr1EYSazThyKv=5g@mail.gmail.com","subject":"Re: [PATCH] sideband.c: Get rid of ANSI sequence for non-terminal shell","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-05-27T16:47:25Z","receivedAt":"2014-05-27T16:47:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, May 27, 2014 at 01:27:12PM +1000, Michael Naumov wrote:\n\n> From ae8d04fdbd71cf322e67903826544d5431f2866d Mon Sep 17 00:00:00 2001\n> From: Michael Naumov <mnaoumov@gmail.com>\n> Date: Tue, 27 May 2014 12:45:06 +1000\n> Subject: [PATCH] sideband.c: Get rid of ANSI sequence for non-terminal shell\n\nYou can drop these lines; they are redundant with your email's headers\n(but see below for more email tips).\n\n> Some git tools such as GitExtensions for Windows use environment variable\n> TERM=msys which causes the weird ANSI sequence shown for the messages\n> returned from server-side hooks\n> \n> See https://github.com/gitextensions/gitextensions/issues/1313 for more\n> details\n\nIt's nice to give a pointer to more discussion, but it's also a good\nidea to give a one- or two-sentence summary. Something like (after your\nfirst paragraph):\n\n  We add those ANSI sequences to help format sideband data on the user's\n  terminal. However, these extensions are not using a terminal, and the\n  sequences just confuse them. We can recognize this use by checking\n  isatty().\n\n> NOTE: I considered to cover the case that a pager has already been started.\n> But decided that is probably not worth worrying about here, though, as we\n> shouldn't be using a pager for commands that do network communications (and\n> if we do, omitting the magic line-clearing signal is probably a sane thing\n> to do).\n\nI was nodding my head in agreement at this, and then went back and\nrealized that it is paraphrasing me. So I definitely agree with it. :)\n\n> Signed-off-by: Michael Naumov <mnaoumov@gmail.com>\n> \n> Thanks-to: Erik Faye-Lund <kusmabite@gmail.com>\n> Thanks-to: Jeff King <peff@peff.net>\n\nA minor nit, but please keep these \"trailers\" together in a single\nparagraph. Elsewhere on the list people are developing tools to write\nand parse them, and I believe that they only look backwards up to the\nlast empty line.\n\n> diff --git a/sideband.c b/sideband.c\n> index d1125f5..7f9dc22 100644\n> --- a/sideband.c\n> +++ b/sideband.c\n> @@ -30,7 +30,7 @@ int recv_sideband(const char *me, int in_stream, int out)\n> \n>   memcpy(buf, PREFIX, pf);\n>   term = getenv(\"TERM\");\n> - if (term && strcmp(term, \"dumb\"))\n> + if (isatty(2) && term && strcmp(term, \"dumb\"))\n>   suffix = ANSI_SUFFIX;\n>   else\n>   suffix = DUMB_SUFFIX;\n\nYour patch looks whitespace damaged. It was also sent as a\nmultipart/alternative with html, which I suspect means it did not make\nit to the list. It looks like you're using gmail. The simplest thing is\nto just use git-send-email to send it; there are tips for configuring\nsend-email with gmail in \"git help send-email\".\n\n-Peff\n"}]}