[PATCH v4 09/28] format_trailers_from_commit(): indirectly call trailer_info_get()
- From
- Linus Arver via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Feb 6, 2024, 05:12 UTC
- Message-ID
- <6906910417aefafd296997548b77038222883753.1707196348.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1632.v4.git.1707196348.gitgitgadget@gmail.com>
From: Linus Arver <linusa@google.com>
This is another preparatory refactor to unify the trailer formatters.
Instead of calling trailer_info_get() directly, call parse_trailers() which already calls trailer_info_get(). This change is a NOP because format_trailer_info() only looks at the "trailers" string array, not the trailer_item objects which parse_trailers() populates.
In the next patch, we'll change format_trailer_info() to use the parsed trailer_item objects instead of the string array.
Signed-off-by: Linus Arver <linusa@google.com> --- trailer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/trailer.c b/trailer.c index e92d0154d90..e6665c99cc3 100644 --- a/trailer.c +++ b/trailer.c @@ -1140,9 +1140,11 @@ void format_trailers_from_commit(const struct process_trailer_options *opts, const char *msg, struct strbuf *out) { + LIST_HEAD(trailers); struct trailer_info info; - trailer_info_get(opts, msg, &info); + parse_trailers(opts, &info, msg, &trailers); + /* If we want the whole block untouched, we can take the fast path. */ if (!opts->only_trailers && !opts->unfold && !opts->filter && !opts->separator && !opts->key_only && !opts->value_only && @@ -1152,6 +1154,7 @@ void format_trailers_from_commit(const struct process_trailer_options *opts, } else format_trailer_info(opts, &info, out); + free_trailers(&trailers); trailer_info_release(&info); }
-- gitgitgadget