From: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
To: lars.schneider@autodesk.com, git@vger.kernel.org
Cc: gitster@pobox.com, sbeller@google.com, sunshine@sunshineco.com,
sandals@crustytoothpaste.net, peff@peff.net,
Lars Schneider <larsxschneider@gmail.com>
Subject: Re: [PATCH v4 1/2] refactor "dumb" terminal determination
Date: Fri, 1 Dec 2017 08:56:43 +0530 [thread overview]
Message-ID: <a9786a9f-66c9-9f1e-75c8-b2c5a81b08aa@gmail.com> (raw)
In-Reply-To: <20171129143752.60553-2-lars.schneider@autodesk.com>
On Wednesday 29 November 2017 08:07 PM, lars.schneider@autodesk.com wrote:
> +int is_terminal_dumb(void)
> +{
> + const char *terminal = getenv("TERM");
> + return !terminal || !strcmp(terminal, "dumb");
So, IIUC, there terminal is considered to be 'dumb' when the TERM
environment variable is NOT set or when it is set to 'dumb'.
> +}
> +
> const char *git_editor(void)
> {
> const char *editor = getenv("GIT_EDITOR");
> - const char *terminal = getenv("TERM");
> - int terminal_is_dumb = !terminal || !strcmp(terminal, "dumb");
> + int terminal_is_dumb = is_terminal_dumb();
>
> if (!editor && editor_program)
> editor = editor_program;
> diff --git a/sideband.c b/sideband.c
> index 1e4d684d6c..6d7f943e43 100644
> --- a/sideband.c
> +++ b/sideband.c
> @@ -20,13 +20,12 @@
>
> int recv_sideband(const char *me, int in_stream, int out)
> {
> - const char *term, *suffix;
> + const char *suffix;
> char buf[LARGE_PACKET_MAX + 1];
> struct strbuf outbuf = STRBUF_INIT;
> int retval = 0;
>
> - term = getenv("TERM");
> - if (isatty(2) && term && strcmp(term, "dumb"))
> + if (isatty(2) && !is_terminal_dumb())
> suffix = ANSI_SUFFIX;
> else
> suffix = DUMB_SUFFIX;
>
This one looks good to me if my observation above is correct.
---
Kaartic
next prev parent reply other threads:[~2017-12-01 3:26 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-29 14:37 [PATCH v4 0/2] launch_editor(): indicate that Git waits for user input lars.schneider
2017-11-29 14:37 ` [PATCH v4 1/2] refactor "dumb" terminal determination lars.schneider
2017-11-30 20:30 ` Jeff King
2017-12-01 3:26 ` Kaartic Sivaraam [this message]
2017-11-29 14:37 ` [PATCH v4 2/2] launch_editor(): indicate that Git waits for user input lars.schneider
2017-11-30 20:51 ` Jeff King
2017-12-01 3:56 ` Kaartic Sivaraam
2017-12-01 12:52 ` Lars Schneider
2017-12-01 18:29 ` Jeff King
2017-12-02 3:45 ` Kaartic Sivaraam
2017-12-03 16:39 ` Lars Schneider
2017-12-04 16:41 ` Kaartic Sivaraam
2017-12-04 17:26 ` Jeff King
2017-12-04 21:31 ` Lars Schneider
2017-12-04 21:42 ` Jeff King
2017-12-04 21:54 ` Lars Schneider
2017-12-04 22:09 ` Jeff King
2017-12-04 17:25 ` Jeff King
2017-12-03 5:15 ` Junio C Hamano
2017-12-03 12:47 ` Lars Schneider
2017-12-04 17:32 ` Jeff King
2017-12-04 21:34 ` Lars Schneider
2017-12-04 21:40 ` Junio C Hamano
2017-12-04 17:30 ` Jeff King
2017-11-29 18:35 ` [PATCH v4 0/2] " Thomas Adam
2017-11-30 13:55 ` Lars Schneider
2017-11-30 14:42 ` Thomas Adam
2017-11-30 15:13 ` Andreas Schwab
2017-12-01 3:41 ` Kaartic Sivaraam
2017-11-30 20:12 ` Jeff King
2017-11-30 20:51 ` Thomas Adam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a9786a9f-66c9-9f1e-75c8-b2c5a81b08aa@gmail.com \
--to=kaartic.sivaraam@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=lars.schneider@autodesk.com \
--cc=larsxschneider@gmail.com \
--cc=peff@peff.net \
--cc=sandals@crustytoothpaste.net \
--cc=sbeller@google.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).