aboutsummaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-03-26 14:03:57 -0700
committerJunio C Hamano <gitster@pobox.com>2026-03-26 14:03:57 -0700
commitf54477a8053716221ccbdfbbcb9cef4e9d26fe28 (patch)
tree098ab742e268c4bf60b2a572f247b65667cdecff /pretty.c
parent67006b9db8b772423ad0706029286096307d2567 (diff)
parent36c16a5b7fff7806b475b5fa07eca3a5179d7fa6 (diff)
downloadgit-f54477a8053716221ccbdfbbcb9cef4e9d26fe28.tar.xz
Merge branch 'mf/format-patch-commit-list-format' into mf/format-patch-commit-list-format-doc
* mf/format-patch-commit-list-format: format-patch: --commit-list-format without prefix format-patch: add preset for --commit-list-format format-patch: wrap generate_commit_list_cover() format.commitListFormat: strip meaning from empty docs/pretty-formats: add %(count) and %(total) format-patch: rename --cover-letter-format option format-patch: refactor generate_commit_list_cover pretty.c: better die message %(count) and %(total) 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..814803980b 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(_("%s is not supported by this command"), "%(count)");
+ 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(_("%s is not supported by this command"), "%(total)");
+ 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));