diff options
author | Andy Koppe <andy.koppe@gmail.com> | 2023-08-20 18:50:04 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-08-21 18:40:09 (GMT) |
commit | a3883a6532163f0a53a7b202f32bf8fe565af056 (patch) | |
tree | eba20122b493f942aeff9bb9b12fbcf44bb7cbbe /pretty.c | |
parent | 31a922f8383ea75b5757d2f9d0615c85b2083b5a (diff) | |
download | git-a3883a6532163f0a53a7b202f32bf8fe565af056.zip git-a3883a6532163f0a53a7b202f32bf8fe565af056.tar.gz git-a3883a6532163f0a53a7b202f32bf8fe565af056.tar.bz2 |
decorate: refactor format_decorations()
Rename the format_decorations_extended function to format_decorations
and drop the format_decorations wrapper macro. Pass the prefix, suffix
and separator strings as a single 'struct format_decorations' pointer
argument instead of separate arguments. Use default values defined in
the function when either the struct pointer or any of the struct fields
are NULL. This is to ease extension with additional options.
Signed-off-by: Andy Koppe <andy.koppe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r-- | pretty.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -1537,11 +1537,18 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ strbuf_addstr(sb, get_revision_mark(NULL, commit)); return 1; case 'd': - format_decorations(sb, commit, c->auto_color); + format_decorations(sb, commit, c->auto_color, NULL); return 1; case 'D': - format_decorations_extended(sb, commit, c->auto_color, "", ", ", ""); - return 1; + { + const struct decoration_options opts = { + .prefix = "", + .suffix = "" + }; + + format_decorations(sb, commit, c->auto_color, &opts); + return 1; + } case 'S': /* tag/branch like --source */ if (!(c->pretty_ctx->rev && c->pretty_ctx->rev->sources)) return 0; |