From: Mirko Faina Date: Sat, 14 Mar 2026 23:20:45 GMT Subject: [PATCH 2/7] format-patch: refactor generate_commit_list_cover Message-ID: <086cdfd57206735ed90416e6859ea0067172d708.1773530191.git.mroik@delayed.space> In-Reply-To: Refactor for readability and remove unnecessary initialization. Signed-off-by: Mirko Faina --- builtin/log.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index 716ebc2701..997bdd608e 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1376,12 +1376,11 @@ static void generate_commit_list_cover(FILE *cover_file, const char *format, struct pretty_print_context ctx = {0}; struct rev_info rev = REV_INFO_INIT; - strbuf_init(&commit_line, 0); rev.total = n; ctx.rev = &rev; - for (int i = n - 1; i >= 0; i--) { - rev.nr = n - i; - repo_format_commit_message(the_repository, list[i], format, + for (int i = 1; i <= n; i++) { + rev.nr = i; + repo_format_commit_message(the_repository, list[n - i], format, &commit_line, &ctx); fprintf(cover_file, "%s\n", commit_line.buf); strbuf_reset(&commit_line); -- 2.53.0.959.g497ff81fa9