Use promisor_remote_get_direct() and has_promisor_remote()
[gitweb.git] / trailer.c
index d6da555cd71bed97acae89bc37787b81dfe423f4..0c414f2fed2b5701f616eb2d88a386e5da16fda8 100644 (file)
--- a/trailer.c
+++ b/trailer.c
@@ -1129,10 +1129,11 @@ static void format_trailer_info(struct strbuf *out,
                                const struct trailer_info *info,
                                const struct process_trailer_options *opts)
 {
+       size_t origlen = out->len;
        size_t i;
 
        /* If we want the whole block untouched, we can take the fast path. */
-       if (!opts->only_trailers && !opts->unfold && !opts->filter) {
+       if (!opts->only_trailers && !opts->unfold && !opts->filter && !opts->separator) {
                strbuf_add(out, info->trailer_start,
                           info->trailer_end - info->trailer_start);
                return;
@@ -1151,13 +1152,25 @@ static void format_trailer_info(struct strbuf *out,
                                if (opts->unfold)
                                        unfold_value(&val);
 
-                               strbuf_addf(out, "%s: %s\n", tok.buf, val.buf);
+                               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);
+                               if (!opts->separator)
+                                       strbuf_addch(out, '\n');
                        }
                        strbuf_release(&tok);
                        strbuf_release(&val);
 
                } else if (!opts->only_trailers) {
+                       if (opts->separator && out->len != origlen) {
+                               strbuf_addbuf(out, opts->separator);
+                       }
                        strbuf_addstr(out, trailer);
+                       if (opts->separator) {
+                               strbuf_rtrim(out);
+                       }
                }
        }