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

[PATCH] blame: only parse detailed commit info if needed

From
Han Young <hanyang.tony@bytedance.com>
Date
Jul 22, 2025, 11:42 UTC
Message-ID
<20250722114220.87570-1-hanyang.tony@bytedance.com>

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
Next: Patrick Steinhardt
Message 1 of 4 in “blame: only parse detailed commit info if needed”
  1. blame: only parse detailed commit info if neededHan Young, Jul 22, 2025
  2. Patrick SteinhardtJul 22, 2025
  3. Junio C HamanoJul 22, 2025
  4. Han YoungJul 23, 2025

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.