diff options
| author | Junio C Hamano <gitster@pobox.com> | 2026-03-16 12:42:54 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-16 12:42:54 -0700 |
| commit | b3c222ed9103db7947b432a99d460e22bdc873ca (patch) | |
| tree | b8edc42f69bfb0da8b690501a7826e3845107696 /pretty.c | |
| parent | 67006b9db8b772423ad0706029286096307d2567 (diff) | |
| parent | 51ed9f7e724468b8e44a7c33946dda38a335acca (diff) | |
| download | git-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.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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)); |
