diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2014-09-18 21:53:53 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-09-18 15:15:21 -0700 |
commit | 9271095cc5571e306d709ebf8eb7f0a388254d9d (patch) | |
tree | 82f6c8af5766632711b0daa9012f4af903c1b3bb /log-tree.c | |
parent | 96db324a73fdada6fbe7b63221986f8f18cc63b0 (diff) | |
download | git-9271095cc5571e306d709ebf8eb7f0a388254d9d.tar.gz |
pretty: add %D format specifierhj/pretty-naked-decoration
Add a new format specifier, '%D' that is identical in behaviour to '%d',
except that it does not include the ' (' prefix or ')' suffix provided
by '%d'.
Signed-off-by: Harry Jeffery <harry@exec64.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'log-tree.c')
-rw-r--r-- | log-tree.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/log-tree.c b/log-tree.c index 0c53dc11ab..f120fd34d1 100644 --- a/log-tree.c +++ b/log-tree.c @@ -179,14 +179,16 @@ static void show_children(struct rev_info *opt, struct commit *commit, int abbre } /* - * The caller makes sure there is no funny color before - * calling. format_decorations makes sure the same after return. + * The caller makes sure there is no funny color before calling. + * format_decorations_extended makes sure the same after return. */ -void format_decorations(struct strbuf *sb, +void format_decorations_extended(struct strbuf *sb, const struct commit *commit, - int use_color) + int use_color, + const char *prefix, + const char *separator, + const char *suffix) { - const char *prefix; struct name_decoration *decoration; const char *color_commit = diff_get_color(use_color, DIFF_COMMIT); @@ -196,7 +198,6 @@ void format_decorations(struct strbuf *sb, decoration = lookup_decoration(&name_decoration, &commit->object); if (!decoration) return; - prefix = " ("; while (decoration) { strbuf_addstr(sb, color_commit); strbuf_addstr(sb, prefix); @@ -205,11 +206,11 @@ void format_decorations(struct strbuf *sb, strbuf_addstr(sb, "tag: "); strbuf_addstr(sb, decoration->name); strbuf_addstr(sb, color_reset); - prefix = ", "; + prefix = separator; decoration = decoration->next; } strbuf_addstr(sb, color_commit); - strbuf_addch(sb, ')'); + strbuf_addstr(sb, suffix); strbuf_addstr(sb, color_reset); } |