Re: [RFC PATCH v2] format-patch: better commit list for cover letter
- From
Mirko Faina <mroik@delayed.space>
- Date
- Feb 21, 2026, 00:51 UTC
- Message-ID
- <aZkAo4_RmfKNFwow@exploit>
- In-Reply-To
- <20260220235502.759002-1-mroik@delayed.space>
On Sat, Feb 21, 2026 at 12:55:01AM +0100, Mirko Faina wrote:
Show 11 quoted lines
> + for (int i = 0; i < nr; i++) {
> + strbuf_init(sb_loglines, 0);
> + strbuf_addf(sb_loglines, "[%0*d/%d] ", decimal_width(nr), i + 1, nr);
> + temp = sb_loglines->len;
> + strbuf_addstr(sb_loglines, oid_to_hex_r(commit_hash_buf, &list[i]->object.oid));
> + strbuf_remove(sb_loglines, temp + 8, sb_loglines->len - (temp + 8));
> + strbuf_addch(sb_loglines, ':');
> + strbuf_addch(sb_loglines, ' ');
> + pp_commit_easy(CMIT_FMT_ONELINE, list[i], sb_loglines);
> + fprintf(cover_file, "%s\n", sb_loglines->buf);
> + }I also noticed it generates the list in the reversed order (and probably leaks), but this was just a PoC and I'm more interested in knowing if the format is liked by the users.