blame: remove parameter detailed in get_commit_info()
The get_commit_info() function accepts a parameter that can be used to stop the commit parsing early. However, none of the callers use this feature, and testing proved that the performance gain of stopping parsing early is negligible and unmeasurable. Signed-off-by: Han Young <hanyang.tony@bytedance.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Han Young committed
Jul 28, 2025 at 11:55 UTC
7e2943128e8aad1b409828e72905d6c63c9f748d
1 file changed
+4
-11
builtin/blame.c
+4
-11
@@ -197,9 +197,7 @@ static void commit_info_destroy(struct commit_info *ci)
197
strbuf_release(&ci->summary);
198
}
199
200
-static void get_commit_info(struct commit *commit,
201
- struct commit_info *ret,
202
- int detailed)
200
+static void get_commit_info(struct commit *commit, struct commit_info *ret)
201
{
202
int len;
203
const char *subject, *encoding;
@@ -211,11 +209,6 @@ static void get_commit_info(struct commit *commit,
209
&ret->author, &ret->author_mail,
210
&ret->author_time, &ret->author_tz);
211
214
- if (!detailed) {
215
- repo_unuse_commit_buffer(the_repository, commit, message);
216
- return;
217
- }
218
-
212
get_ac_line(message, "\ncommitter ",
213
&ret->committer, &ret->committer_mail,
214
&ret->committer_time, &ret->committer_tz);
@@ -263,7 +256,7 @@ static int emit_one_suspect_detail(struct blame_origin *suspect, int repeat)
256
return 0;
257
258
suspect->commit->object.flags |= METAINFO_SHOWN;
266
- get_commit_info(suspect->commit, &ci, 1);
259
+ get_commit_info(suspect->commit, &ci);
260
printf("author %s\n", ci.author.buf);
261
printf("author-mail %s\n", ci.author_mail.buf);
262
printf("author-time %"PRItime"\n", ci.author_time);
@@ -471,7 +464,7 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
464
int show_raw_time = !!(opt & OUTPUT_RAW_TIMESTAMP);
465
const char *default_color = NULL, *color = NULL, *reset = NULL;
466
474
- get_commit_info(suspect->commit, &ci, 1);
467
+ get_commit_info(suspect->commit, &ci);
468
oid_to_hex_r(hex, &suspect->commit->object.oid);
469
470
cp = blame_nth_line(sb, ent->lno);
@@ -665,7 +658,7 @@ static void find_alignment(struct blame_scoreboard *sb, int *option)
658
if (!(suspect->commit->object.flags & METAINFO_SHOWN)) {
659
struct commit_info ci = COMMIT_INFO_INIT;
660
suspect->commit->object.flags |= METAINFO_SHOWN;
668
- get_commit_info(suspect->commit, &ci, 1);
661
+ get_commit_info(suspect->commit, &ci);
662
if (*option & OUTPUT_SHOW_EMAIL)
663
num = utf8_strwidth(ci.author_mail.buf);
664
else