git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Han Young <hanyang.tony@bytedance.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Han Young <hanyang.tony@bytedance.com>
Subject: [PATCH] blame: only parse detailed commit info if needed
Date: Tue, 22 Jul 2025 19:42:20 +0800	[thread overview]
Message-ID: <20250722114220.87570-1-hanyang.tony@bytedance.com> (raw)

In commit cee7f245d (git-pickaxe: blame rewritten., 2006-10-19),
The function get_commit_info can terminate commit parsing early if only
the author information is needed. This ability is not used by callers
who do not require detailed commit information. Stop requesting detailed
commit information for these callers.

Signed-off-by: Han Young <hanyang.tony@bytedance.com>
---
 builtin/blame.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/blame.c b/builtin/blame.c
index 91586e685..b6a38e530 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -471,7 +471,7 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
 	int show_raw_time = !!(opt & OUTPUT_RAW_TIMESTAMP);
 	const char *default_color = NULL, *color = NULL, *reset = NULL;
 
-	get_commit_info(suspect->commit, &ci, 1);
+	get_commit_info(suspect->commit, &ci, 0);
 	oid_to_hex_r(hex, &suspect->commit->object.oid);
 
 	cp = blame_nth_line(sb, ent->lno);
@@ -665,7 +665,7 @@ static void find_alignment(struct blame_scoreboard *sb, int *option)
 		if (!(suspect->commit->object.flags & METAINFO_SHOWN)) {
 			struct commit_info ci = COMMIT_INFO_INIT;
 			suspect->commit->object.flags |= METAINFO_SHOWN;
-			get_commit_info(suspect->commit, &ci, 1);
+			get_commit_info(suspect->commit, &ci, 0);
 			if (*option & OUTPUT_SHOW_EMAIL)
 				num = utf8_strwidth(ci.author_mail.buf);
 			else
-- 
2.50.1.321.gea4e667e7


             reply	other threads:[~2025-07-22 11:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-22 11:42 Han Young [this message]
2025-07-22 14:15 ` [PATCH] blame: only parse detailed commit info if needed Patrick Steinhardt
2025-07-22 17:08   ` Junio C Hamano
2025-07-23  6:02   ` [External] " Han Young

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=20250722114220.87570-1-hanyang.tony@bytedance.com \
    --to=hanyang.tony@bytedance.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).