aboutsummaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-03-16 12:42:54 -0700
committerJunio C Hamano <gitster@pobox.com>2026-03-16 12:42:54 -0700
commitb3c222ed9103db7947b432a99d460e22bdc873ca (patch)
treeb8edc42f69bfb0da8b690501a7826e3845107696 /pretty.c
parent67006b9db8b772423ad0706029286096307d2567 (diff)
parent51ed9f7e724468b8e44a7c33946dda38a335acca (diff)
downloadgit-b3c222ed9103db7947b432a99d460e22bdc873ca.tar.xz
Merge branch 'mf/format-patch-cover-letter-format' into mf/format-patch-commit-list-format
* mf/format-patch-cover-letter-format: docs: add usage for the cover-letter fmt feature format-patch: add commitListFormat config format-patch: add ability to use alt cover format format-patch: move cover letter summary generation pretty.c: add %(count) and %(total) placeholders
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/pretty.c b/pretty.c
index ebf4da4834..74673714c8 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1549,6 +1549,21 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
if (!commit->object.parsed)
parse_object(the_repository, &commit->object.oid);
+ if (starts_with(placeholder, "(count)")) {
+ if (!c->pretty_ctx->rev)
+ die(_("this format specifier can't be used with this command"));
+ strbuf_addf(sb, "%0*d", decimal_width(c->pretty_ctx->rev->total),
+ c->pretty_ctx->rev->nr);
+ return 7;
+ }
+
+ if (starts_with(placeholder, "(total)")) {
+ if (!c->pretty_ctx->rev)
+ die(_("this format specifier can't be used with this command"));
+ strbuf_addf(sb, "%d", c->pretty_ctx->rev->total);
+ return 7;
+ }
+
switch (placeholder[0]) {
case 'H': /* commit hash */
strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_COMMIT));