pretty: add pointer and tag options to %(decorate)

Add pointer and tag options to %(decorate) format, to allow to override
the " -> " string used to show where HEAD points and the "tag: " string
used to mark tags.

Document in pretty-formats.txt and test in t4205-log-pretty-formats.sh.

Signed-off-by: Andy Koppe <andy.koppe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Andy Koppe
2023-08-20 19:50:08 +01:00
committed by Junio C Hamano
parent a58dd835e9
commit f1f8a25856
5 changed files with 31 additions and 5 deletions

View File

@ -1407,7 +1407,9 @@ static void parse_decoration_options(const char **arg,
{
while (parse_decoration_option(arg, "prefix", &opts->prefix) ||
parse_decoration_option(arg, "suffix", &opts->suffix) ||
parse_decoration_option(arg, "separator", &opts->separator))
parse_decoration_option(arg, "separator", &opts->separator) ||
parse_decoration_option(arg, "pointer", &opts->pointer) ||
parse_decoration_option(arg, "tag", &opts->tag))
;
}
@ -1416,6 +1418,8 @@ static void free_decoration_options(const struct decoration_options *opts)
free(opts->prefix);
free(opts->suffix);
free(opts->separator);
free(opts->pointer);
free(opts->tag);
}
static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */