diff options
author | Linus Arver <linusa@google.com> | 2024-03-01 00:14:44 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-01 10:35:42 -0800 |
commit | bf35e0a018cf6d35834e762ac524754024800ad6 (patch) | |
tree | 2221c373bc12ecefc597f6509706a3378c19f091 /builtin | |
parent | 9aa1b2bc890cea43f2b9aa3379ca88e98a17801f (diff) | |
download | git-bf35e0a018cf6d35834e762ac524754024800ad6.tar.gz |
format_trailers(): use strbuf instead of FILE
This is another preparatory refactor to unify the trailer formatters.
Make format_trailers() also write to a strbuf, to align with
format_trailers_from_commit() which also does the same. Doing this makes
format_trailers() behave similar to format_trailer_info() (which will
soon help us replace one with the other).
Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/interpret-trailers.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c index d1cf0aa33a..11f4ce9e4a 100644 --- a/builtin/interpret-trailers.c +++ b/builtin/interpret-trailers.c @@ -140,6 +140,7 @@ static void interpret_trailers(const struct process_trailer_options *opts, { LIST_HEAD(head); struct strbuf sb = STRBUF_INIT; + struct strbuf trailer_block = STRBUF_INIT; struct trailer_info info; FILE *outfile = stdout; @@ -169,8 +170,11 @@ static void interpret_trailers(const struct process_trailer_options *opts, process_trailers_lists(&head, &arg_head); } - format_trailers(opts, &head, outfile); + /* Print trailer block. */ + format_trailers(opts, &head, &trailer_block); free_trailers(&head); + fwrite(trailer_block.buf, 1, trailer_block.len, outfile); + strbuf_release(&trailer_block); /* Print the lines after the trailers as is */ if (!opts->only_trailers) |