From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC] ignore unknown color configuration
Date: Tue, 15 Dec 2009 17:29:18 -0800 [thread overview]
Message-ID: <7vy6l3vh8x.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20091212122524.GA17547@coredump.intra.peff.net> (Jeff King's message of "Sat\, 12 Dec 2009 07\:25\:24 -0500")
Jeff King <peff@peff.net> writes:
> diff --git a/builtin-branch.c b/builtin-branch.c
> index 05e876e..c87e63b 100644
> --- a/builtin-branch.c
> +++ b/builtin-branch.c
> @@ -65,7 +65,7 @@ static int parse_branch_color_slot(const char *var, int ofs)
> return BRANCH_COLOR_LOCAL;
> if (!strcasecmp(var+ofs, "current"))
> return BRANCH_COLOR_CURRENT;
> - die("bad config variable '%s'", var);
> + return -1;
> }
>
> static int git_branch_config(const char *var, const char *value, void *cb)
> @@ -76,6 +76,8 @@ static int git_branch_config(const char *var, const char *value, void *cb)
> }
> if (!prefixcmp(var, "color.branch.")) {
> int slot = parse_branch_color_slot(var, 13);
> + if (slot < 0)
> + return 0;
> if (!value)
> return config_error_nonbool(var);
> color_parse(value, var, branch_colors[slot]);
> diff --git a/builtin-commit.c b/builtin-commit.c
> index e93a647..326cd63 100644
> --- a/builtin-commit.c
> +++ b/builtin-commit.c
> @@ -890,7 +890,7 @@ static int parse_status_slot(const char *var, int offset)
> return WT_STATUS_NOBRANCH;
> if (!strcasecmp(var+offset, "unmerged"))
> return WT_STATUS_UNMERGED;
> - die("bad config variable '%s'", var);
> + return -1;
> }
>
> static int git_status_config(const char *k, const char *v, void *cb)
> @@ -910,6 +910,8 @@ static int git_status_config(const char *k, const char *v, void *cb)
> }
> if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
> int slot = parse_status_slot(k, 13);
> + if (slot < 0)
> + return -1;
Shouldn't this return 0, to say "we handled it (by ignoring), don't
worry", instead of saying "hey it's error" by returning -1? That's what
is done on the "diff" side below...
> diff --git a/diff.c b/diff.c
> index d952686..08bbd3e 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -122,6 +122,8 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)
>
> if (!prefixcmp(var, "diff.color.") || !prefixcmp(var, "color.diff.")) {
> int slot = parse_diff_color_slot(var, 11);
> + if (slot < 0)
> + return 0;
> if (!value)
> return config_error_nonbool(var);
> color_parse(value, var, diff_colors[slot]);
next prev parent reply other threads:[~2009-12-16 1:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-12 12:25 [PATCH/RFC] ignore unknown color configuration Jeff King
2009-12-12 21:45 ` Junio C Hamano
2009-12-12 22:20 ` Jeff King
2009-12-14 2:33 ` Junio C Hamano
2009-12-16 1:25 ` Junio C Hamano
2009-12-16 3:45 ` Jeff King
2009-12-16 1:29 ` Junio C Hamano [this message]
2009-12-16 3:46 ` Jeff King
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=7vy6l3vh8x.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox