summaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-29 12:36:08 -0700
committerJunio C Hamano <gitster@pobox.com>2014-09-29 12:36:09 -0700
commitb8e533f12acec63242c5405286fbbcfa66eecfdd (patch)
tree32ededef297ace728b1c59a5425b8b383eae75a8 /log-tree.c
parenta9583afc1df1df10d60d2b81fd4b0976bc67ca4e (diff)
parent9271095cc5571e306d709ebf8eb7f0a388254d9d (diff)
downloadgit-b8e533f12acec63242c5405286fbbcfa66eecfdd.tar.gz
Merge branch 'hj/pretty-naked-decoration'
The pretty-format specifier "%d", which expanded to " (tagname)" for a tagged commit, gained a cousin "%D" that just gives the "tagname" without frills. * hj/pretty-naked-decoration: pretty: add %D format specifier
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/log-tree.c b/log-tree.c
index bcee7c5966..cff7ac1dbd 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -174,14 +174,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;
const struct name_decoration *decoration;
const char *color_commit =
diff_get_color(use_color, DIFF_COMMIT);
@@ -191,7 +193,6 @@ void format_decorations(struct strbuf *sb,
decoration = get_name_decoration(&commit->object);
if (!decoration)
return;
- prefix = " (";
while (decoration) {
strbuf_addstr(sb, color_commit);
strbuf_addstr(sb, prefix);
@@ -200,11 +201,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);
}