]> git.ipfire.org Git - thirdparty/git.git/commitdiff
pretty.c: better die message %(count) and %(total)
authorMirko Faina <mroik@delayed.space>
Mon, 23 Mar 2026 16:57:28 +0000 (17:57 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 23 Mar 2026 20:06:58 +0000 (13:06 -0700)
Improve die messages for commands that do not support %(count) and
%(total)

Signed-off-by: Mirko Faina <mroik@delayed.space>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pretty.c

index 74673714c8d39a4d754de12f95db5c824eca44c9..814803980b8d1a239bad7a25d34e26a3219ae961 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -1551,7 +1551,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
 
        if (starts_with(placeholder, "(count)")) {
                if (!c->pretty_ctx->rev)
-                       die(_("this format specifier can't be used with this command"));
+                       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;
@@ -1559,7 +1559,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
 
        if (starts_with(placeholder, "(total)")) {
                if (!c->pretty_ctx->rev)
-                       die(_("this format specifier can't be used with this command"));
+                       die(_("%s is not supported by this command"), "%(total)");
                strbuf_addf(sb, "%d", c->pretty_ctx->rev->total);
                return 7;
        }