From: Junio C Hamano <gitster@pobox.com>
To: Han-Wen Nienhuys <hanwen@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] Highlight keywords in remote sideband output.
Date: Tue, 31 Jul 2018 12:45:00 -0700 [thread overview]
Message-ID: <xmqqa7q7b35v.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180731173651.184716-3-hanwen@google.com> (Han-Wen Nienhuys's message of "Tue, 31 Jul 2018 19:36:51 +0200")
Han-Wen Nienhuys <hanwen@google.com> writes:
> The highlighting is done on the client-side. Supported keywords are
> "error", "warning", "hint" and "success".
>
> The colorization is controlled with the config setting "color.remote".
>
> Co-authored-by: Duy Nguyen <pclouds@gmail.com>
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Thanks. I'll squash the following in while queuing, though.
* maybe_colorize_sideband() does not have outside caller; make it
static to avoid missing-prototype error that breaks compilation.
* correct space-before-tab whitespace style violation.
* use write_script.
* a test script must be executable to avoid triggering test-lint.
* avoid overlong lines in the test.
* no SP between redirection operator and its target.
Other than that, the result looks good to me. So that others can
eyeball the result once more, I'll keep it in 'pu' for a few days,
and if nothing else comes up, hopefully the topic can be merged to
'next' after that.
diff --git a/sideband.c b/sideband.c
index 0d67583ec5..be4635446c 100644
--- a/sideband.c
+++ b/sideband.c
@@ -60,12 +60,12 @@ void list_config_color_sideband_slots(struct string_list *list, const char *pref
* Optionally highlight some keywords in remote output if they appear at the
* start of the line.
*/
-void maybe_colorize_sideband(struct strbuf *dest, const char *src, int n)
+static void maybe_colorize_sideband(struct strbuf *dest, const char *src, int n)
{
int i;
load_sideband_colors();
- if (!want_color_stderr(sideband_use_color)) {
+ if (!want_color_stderr(sideband_use_color)) {
strbuf_add(dest, src, n);
return;
}
diff --git a/t/t5409-colorize-remote-messages.sh b/t/t5409-colorize-remote-messages.sh
old mode 100644
new mode 100755
index 4e1bd421ff..4547ec95b8
--- a/t/t5409-colorize-remote-messages.sh
+++ b/t/t5409-colorize-remote-messages.sh
@@ -6,27 +6,27 @@ test_description='remote messages are colorized on the client'
test_expect_success 'setup' '
mkdir .git/hooks &&
- cat << EOF > .git/hooks/update &&
-#!/bin/sh
-echo error: error
-echo hint: hint
-echo success: success
-echo warning: warning
-echo prefixerror: error
-exit 0
-EOF
- chmod +x .git/hooks/update &&
+ write_script .git/hooks/update <<-\EOF &&
+ echo error: error
+ echo hint: hint
+ echo success: success
+ echo warning: warning
+ echo prefixerror: error
+ exit 0
+ EOF
+
echo 1 >file &&
git add file &&
git commit -m 1 &&
git clone . child &&
cd child &&
- echo 2 > file &&
+ echo 2 >file &&
git commit -a -m 2
'
test_expect_success 'push' '
- git -c color.remote=always push -f origin HEAD:refs/heads/newbranch 2>output &&
+ git -c color.remote=always \
+ push -f origin HEAD:refs/heads/newbranch 2>output &&
test_decode_color <output >decoded &&
grep "<BOLD;RED>error<RESET>:" decoded &&
grep "<YELLOW>hint<RESET>:" decoded &&
@@ -36,7 +36,8 @@ test_expect_success 'push' '
'
test_expect_success 'push with customized color' '
- git -c color.remote=always -c color.remote.error=white push -f origin HEAD:refs/heads/newbranch2 2>output &&
+ git -c color.remote=always -c color.remote.error=white \
+ push -f origin HEAD:refs/heads/newbranch2 2>output &&
test_decode_color <output >decoded &&
grep "<WHITE>error<RESET>:" decoded &&
grep "<YELLOW>hint<RESET>:" decoded &&
next prev parent reply other threads:[~2018-07-31 19:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-31 17:36 [PATCH 0/2 v3] Highlight keywords in remote sideband output Han-Wen Nienhuys
2018-07-31 17:36 ` [PATCH 1/2] Document git config getter return value Han-Wen Nienhuys
2018-08-01 8:24 ` Eric Sunshine
2018-07-31 17:36 ` [PATCH 2/2] Highlight keywords in remote sideband output Han-Wen Nienhuys
2018-07-31 19:45 ` Junio C Hamano [this message]
2018-07-31 20:21 ` Eric Sunshine
2018-08-01 15:41 ` Junio C Hamano
2018-08-01 17:18 ` Han-Wen Nienhuys
2018-08-01 18:16 ` Junio C Hamano
2018-08-02 7:34 ` Han-Wen Nienhuys
2018-08-02 10:24 ` Eric Sunshine
2018-08-02 11:46 ` Han-Wen Nienhuys
2018-08-02 17:37 ` Eric Sunshine
2018-08-02 17:44 ` Stefan Beller
2018-08-02 11:43 ` Han-Wen Nienhuys
-- strict thread matches above, loose matches on Subject: below --
2018-07-30 12:26 [PATCH 1/2] Document git config getter return value Han-Wen Nienhuys
2018-07-30 12:26 ` [PATCH 2/2] Highlight keywords in remote sideband output Han-Wen Nienhuys
2018-07-30 12:18 [PATCH 1/2] Document git config getter return value Han-Wen Nienhuys
2018-07-30 12:18 ` [PATCH 2/2] Highlight keywords in remote sideband output Han-Wen Nienhuys
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=xmqqa7q7b35v.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=hanwen@google.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).