factor out strbuf_expand_bad_format()

Extract a function for reporting placeholders that are not enclosed in a
parenthesis or are unknown.  This reduces the number of strings to
translate and improves consistency across commands.  Call it at the end
of the if/else chain, after exhausting all accepted possibilities.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2024-03-24 12:19:40 +01:00
committed by Junio C Hamano
parent 3c2a3fdc38
commit e36091aa1d
4 changed files with 27 additions and 18 deletions

View File

@@ -337,6 +337,11 @@ size_t strbuf_expand_literal(struct strbuf *sb, const char *placeholder);
*/
int strbuf_expand_step(struct strbuf *sb, const char **formatp);
/**
* Used with `strbuf_expand_step` to report unknown placeholders.
*/
void strbuf_expand_bad_format(const char *format, const char *command);
/**
* Append the contents of one strbuf to another, quoting any
* percent signs ("%") into double-percents ("%%") in the