git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] Highlight keywords in remote sideband output.

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 31, 2018, 07:37 UTC
Message-ID
<87tvofua7k.fsf@evledraar.gmail.com>
In-Reply-To
<20180730123334.65186-2-hanwen@google.com>
On Mon, Jul 30 2018, Han-Wen Nienhuys wrote:
Show 14 quoted lines
> +	if (sideband_use_color < 0) {
> +		const char *key = "color.remote";
> +		char *value = NULL;
> +		if (!git_config_get_string(key, &value))
> +			sideband_use_color = git_config_colorbool(key, value);
> [...]
> +	struct kwtable {
> +		const char *keyword;
> +		const char *color;
> +	} keywords[] = {
> +		{"hint", GIT_COLOR_YELLOW},
> +		{"warning", GIT_COLOR_BOLD_YELLOW},
> +		{"success", GIT_COLOR_BOLD_GREEN},
> +		{"error", GIT_COLOR_BOLD_RED},

FWIW I agree with other reviewers that it would be nice if these could be customized, but I also think it can wait for some follow-up patch.

Users who don't like these colors don't have to use them, and then they're no worse off than now, whereas some users will appreciate these and be better off than now.

So great if you want to improve this, but just chiming in on that point because I think we should be respectful of the time of contributors, and not make perfect the enemy of the good.

> +test_expect_success 'setup' '
> +	mkdir .git/hooks &&
> +        cat << EOF > .git/hooks/update &&

It's the coding style of git.git to snuggle the ">" with the filename. I.e. "<<EOF >file", not "<< EOF > file". Same for the other occurrences of ">" etc. below.

Show 5 quoted lines
> +#!/bin/sh
> +echo error: error
> +echo hint: hint
> +echo success: success
> +echo warning: warning

Here I think it makes sense to more exhaustively test the sort of output we do and don't hilight, both for regression testing and to explain this in code. E.g. let's do all of these:

    error: text
    hint: text
    success: text
    warning: text
    PREFIXerror: text
    PREFIXhint: text
    PREFIXsuccess: text
    PREFIXwarning: text
    errorSUFFIX: text
    hintSUFFIX: text
    successSUFFIX: text
    warningSUFFIX: text
	this is an error: text
	this is a hint: text
	this is success: text
	this is a warning: text
Show 6 quoted lines
> +test_expect_success 'push' 'git -c color.remote=always push origin HEAD:refs/heads/newbranch 2>output &&
> +  test_decode_color < output > decoded &&
> +  test_i18ngrep "<BOLD;RED>error<RESET>:" decoded &&
> +  test_i18ngrep "<YELLOW>hint<RESET>:" decoded &&
> +  test_i18ngrep "<BOLD;GREEN>success<RESET>:" decoded &&
> +  test_i18ngrep "<BOLD;YELLOW>warning<RESET>:" decoded'

I think this is a case where we want just "grep", not "test_i18ngrep", that output you just emitted won't be translated.

Previous: Junio C HamanoNext: Duy Nguyen
Message 8 of 9 in “Highlight keywords in remote sideband output.”
  1. 0/1 Highlight keywords in remote sideband output.Han-Wen Nienhuys, Jul 30, 2018
  2. 1/1 Highlight keywords in remote sideband output.Han-Wen Nienhuys, Jul 30, 2018
  3. Duy NguyenJul 30, 2018
  4. brian m. carlsonJul 31, 2018
  5. Junio C HamanoJul 30, 2018
  6. Han-Wen NienhuysJul 31, 2018
  7. Junio C HamanoJul 31, 2018
  8. Ævar Arnfjörð BjarmasonJul 31, 2018
  9. Duy NguyenJul 31, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.