summaryrefslogtreecommitdiff
path: root/trailer.c
diff options
context:
space:
mode:
Diffstat (limited to 'trailer.c')
-rw-r--r--trailer.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/trailer.c b/trailer.c
index 3f7391d793..249ed618ed 100644
--- a/trailer.c
+++ b/trailer.c
@@ -1131,7 +1131,9 @@ static void format_trailer_info(struct strbuf *out,
size_t i;
/* If we want the whole block untouched, we can take the fast path. */
- if (!opts->only_trailers && !opts->unfold && !opts->filter && !opts->separator) {
+ if (!opts->only_trailers && !opts->unfold && !opts->filter &&
+ !opts->separator && !opts->key_only && !opts->value_only &&
+ !opts->key_value_separator) {
strbuf_add(out, info->trailer_start,
info->trailer_end - info->trailer_start);
return;
@@ -1153,8 +1155,15 @@ static void format_trailer_info(struct strbuf *out,
if (opts->separator && out->len != origlen)
strbuf_addbuf(out, opts->separator);
if (!opts->value_only)
- strbuf_addf(out, "%s: ", tok.buf);
- strbuf_addbuf(out, &val);
+ strbuf_addbuf(out, &tok);
+ if (!opts->key_only && !opts->value_only) {
+ if (opts->key_value_separator)
+ strbuf_addbuf(out, opts->key_value_separator);
+ else
+ strbuf_addstr(out, ": ");
+ }
+ if (!opts->key_only)
+ strbuf_addbuf(out, &val);
if (!opts->separator)
strbuf_addch(out, '\n');
}