From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Git Mailing List" <git@vger.kernel.org>
Subject: Re: [PATCH] parse_color: fix return value for numeric color values 0-8
Date: Tue, 20 Jan 2015 15:57:13 -0800 [thread overview]
Message-ID: <xmqqvbk1ypie.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150120221447.GB18778@peff.net> (Jeff King's message of "Tue, 20 Jan 2015 17:14:48 -0500")
Jeff King <peff@peff.net> writes:
> Eek. Definitely an unintended regression. The fix is below. Thanks for
> reporting (and especially for catching during the -rc period!).
>
> You should not need it, but for reference, using "0" is the same as
> "black" (both in old git and new).
>
> -- >8 --
> When commit 695d95d refactored the color parsing, it missed
> a "return 0" when parsing literal numbers 0-8 (which
> represent basic ANSI colors), leading us to report these
> colors as an error.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
Thanks; somebody should have caught this before we applied and
merged to 'master', but the process obviously did not work well.
Sorry and thanks.
> color.c | 1 +
> t/t4026-color.sh | 4 ++++
> 2 files changed, 5 insertions(+)
>
> diff --git a/color.c b/color.c
> index 809b359..9027352 100644
> --- a/color.c
> +++ b/color.c
> @@ -112,6 +112,7 @@ static int parse_color(struct color *out, const char *name, int len)
> } else if (val < 8) {
> out->type = COLOR_ANSI;
> out->value = val;
> + return 0;
> } else if (val < 256) {
> out->type = COLOR_256;
> out->value = val;
> diff --git a/t/t4026-color.sh b/t/t4026-color.sh
> index 267c43b..4d20fea 100755
> --- a/t/t4026-color.sh
> +++ b/t/t4026-color.sh
> @@ -60,6 +60,10 @@ test_expect_success 'absurdly long color specification' '
> "[1;2;4;5;7;22;24;25;27;38;2;255;255;255;48;2;255;255;255m"
> '
>
> +test_expect_success '0-7 are aliases for basic ANSI color names' '
> + color "0 7" "[30;47m"
> +'
> +
> test_expect_success '256 colors' '
> color "254 bold 255" "[1;38;5;254;48;5;255m"
> '
next prev parent reply other threads:[~2015-01-20 23:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-12 23:57 [ANNOUNCE] Git v2.3.0-rc0 Junio C Hamano
2015-01-14 13:11 ` Christian Neukirchen
2015-01-20 21:49 ` Ævar Arnfjörð Bjarmason
2015-01-20 22:14 ` [PATCH] parse_color: fix return value for numeric color values 0-8 Jeff King
2015-01-20 23:57 ` Junio C Hamano [this message]
2015-01-21 0:03 ` Jeff King
2015-01-21 0:36 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqvbk1ypie.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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.
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).