From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: avarab@gmail.com, git@vger.kernel.org
Subject: Re: [PATCH 1/2] builtin/blame: dim uninteresting metadata lines
Date: Wed, 18 Apr 2018 09:34:15 +0900 [thread overview]
Message-ID: <xmqqzi21jqt4.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180417213049.118995-1-sbeller@google.com> (Stefan Beller's message of "Tue, 17 Apr 2018 14:30:48 -0700")
Stefan Beller <sbeller@google.com> writes:
> @@ -375,6 +378,7 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
> struct commit_info ci;
> char hex[GIT_MAX_HEXSZ + 1];
> int show_raw_time = !!(opt & OUTPUT_RAW_TIMESTAMP);
> + const char *color = NULL, *reset = NULL;
>
> get_commit_info(suspect->commit, &ci, 1);
> oid_to_hex_r(hex, &suspect->commit->object.oid);
> @@ -384,6 +388,18 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
> char ch;
> int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? GIT_SHA1_HEXSZ : abbrev;
>
> + if (opt & OUTPUT_COLOR_LINE) {
> + if (cnt > 0) {
> + color = repeated_meta_color;
> + reset = GIT_COLOR_RESET;
> + } else {
> + color = "";
> + reset = "";
Shouldn't these be NULL as you do not want to fputs() these when not
in painting mode anyway? Which would make it consistent with ...
> + }
> + }
> + if (color)
> + fputs(color, stdout);
> +
... this thing which otherwise needs to be "if (color && *color)",
but if you do NULL, can be left as-is ;-)
> @@ -433,6 +449,8 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
> printf(" %*d) ",
> max_digits, ent->lno + 1 + cnt);
> }
> + if (reset)
> + fputs(reset, stdout);
Likewise.
next prev parent reply other threads:[~2018-04-18 0:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-16 22:09 [PATCH 0/2] blame: color line by commit Stefan Beller
2018-04-16 22:09 ` [PATCH 1/2] builtin/blame: dim uninteresting metadata lines Stefan Beller
2018-04-17 3:17 ` Junio C Hamano
2018-04-17 19:04 ` Stefan Beller
2018-04-16 22:09 ` [PATCH 2/2] builtin/blame: highlight recently changed lines Stefan Beller
2018-04-17 3:23 ` Junio C Hamano
2018-04-17 3:29 ` Junio C Hamano
2018-04-17 19:31 ` Stefan Beller
2018-04-17 19:35 ` Stefan Beller
2018-04-17 21:30 ` [PATCH 1/2] builtin/blame: dim uninteresting metadata lines Stefan Beller
2018-04-17 21:30 ` [PATCH 2/2] builtin/blame: highlight recently changed lines Stefan Beller
2018-04-17 21:54 ` Eric Sunshine
2018-04-18 0:39 ` Junio C Hamano
2018-06-09 11:26 ` René Scharfe
2018-06-11 23:56 ` Stefan Beller
2018-06-14 17:37 ` Junio C Hamano
2018-04-18 0:34 ` Junio C Hamano [this message]
2018-04-18 0:12 ` 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=xmqqzi21jqt4.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=sbeller@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.
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).