git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Fwd: [PATCH] Remove terminal symbols from non-terminal console
       [not found] <CABHRWd1T=a8Mze20G9koiTr0L2Nrq0g3vGLC9mEZ7rA45vgfSA@mail.gmail.com>
@ 2012-11-05 23:17 ` Michael Naumov
  2012-11-08 16:51   ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Naumov @ 2012-11-05 23:17 UTC (permalink / raw
  To: git, gitster

As per discussion on msysgit user group:
https://groups.google.com/forum/?fromgroups=#!topic/msysgit/U_a982_a3rc/discussion
we found the following patch is required to get rid of weird terminal
characters for other tools such as GitExtensions for Windows

---8<---
diff --git a/sideband.c b/sideband.c
index d5ffa1c..bd3e5a8 100644
--- a/sideband.c
+++ b/sideband.c
@@ -29,7 +29,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(out) && term && strcmp(term, "dumb"))
  suffix = ANSI_SUFFIX;
  else
  suffix = DUMB_SUFFIX;
---8<---

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Fwd: [PATCH] Remove terminal symbols from non-terminal console
  2012-11-05 23:17 ` Fwd: [PATCH] Remove terminal symbols from non-terminal console Michael Naumov
@ 2012-11-08 16:51   ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2012-11-08 16:51 UTC (permalink / raw
  To: Michael Naumov; +Cc: git, gitster

On Tue, Nov 06, 2012 at 10:17:21AM +1100, Michael Naumov wrote:

> As per discussion on msysgit user group:
> https://groups.google.com/forum/?fromgroups=#!topic/msysgit/U_a982_a3rc/discussion
> we found the following patch is required to get rid of weird terminal
> characters for other tools such as GitExtensions for Windows
> 
> ---8<---

Please follow SubmittingPatches (missing signoff, weird use of scissors
marker that cuts out your commit message, and your commit message should
summarize the discussion).

> @@ -29,7 +29,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(out) && term && strcmp(term, "dumb"))
>   suffix = ANSI_SUFFIX;
>   else
>   suffix = DUMB_SUFFIX;

Is that right? The "out" fd is where we send sideband 1, and it is
almost always not going to be a tty. The suffix should be sent with
sideband 2, which goes to stderr. So I'd think you would want to check
isatty(2).

Also, most isatty checks also need to cover the case that a pager has
already been started.  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).

I think the overall goal is a step in the right direction, though.

-Peff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-08 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CABHRWd1T=a8Mze20G9koiTr0L2Nrq0g3vGLC9mEZ7rA45vgfSA@mail.gmail.com>
2012-11-05 23:17 ` Fwd: [PATCH] Remove terminal symbols from non-terminal console Michael Naumov
2012-11-08 16:51   ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).