aboutsummaryrefslogtreecommitdiffstats
path: root/trailer.c
diff options
context:
space:
mode:
authorLinus Arver <linusa@google.com>2024-03-01 00:14:43 +0000
committerJunio C Hamano <gitster@pobox.com>2024-03-01 10:35:42 -0800
commit9aa1b2bc890cea43f2b9aa3379ca88e98a17801f (patch)
tree52a9dc1b2469182356be73bc60bbd5efedd60982 /trailer.c
parentae0ec2e0e0bb26474f395504c6ed6fef3f59091f (diff)
downloadgit-9aa1b2bc890cea43f2b9aa3379ca88e98a17801f.tar.gz
trailer_info_get(): reorder parameters
This is another preparatory refactor to unify the trailer formatters. Take const struct process_trailer_options *opts as the first parameter, because these options are required for parsing trailers (e.g., whether to treat "---" as the end of the log message). And take struct trailer_info *info last, because it's an "out parameter" (something that the caller wants to use as the output of this function). Signed-off-by: Linus Arver <linusa@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trailer.c')
-rw-r--r--trailer.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/trailer.c b/trailer.c
index 5025be9789..f92d844361 100644
--- a/trailer.c
+++ b/trailer.c
@@ -997,7 +997,7 @@ void parse_trailers(const struct process_trailer_options *opts,
struct strbuf val = STRBUF_INIT;
size_t i;
- trailer_info_get(info, str, opts);
+ trailer_info_get(opts, str, info);
for (i = 0; i < info->trailer_nr; i++) {
int separator_pos;
@@ -1032,8 +1032,9 @@ void free_trailers(struct list_head *trailers)
}
}
-void trailer_info_get(struct trailer_info *info, const char *str,
- const struct process_trailer_options *opts)
+void trailer_info_get(const struct process_trailer_options *opts,
+ const char *str,
+ struct trailer_info *info)
{
size_t end_of_log_message = 0, trailer_block_start = 0;
struct strbuf **trailer_lines, **ptr;
@@ -1150,7 +1151,7 @@ void format_trailers_from_commit(const struct process_trailer_options *opts,
{
struct trailer_info info;
- trailer_info_get(&info, msg, opts);
+ trailer_info_get(opts, msg, &info);
format_trailer_info(opts, &info, msg, out);
trailer_info_release(&info);
}
@@ -1161,7 +1162,7 @@ void trailer_iterator_init(struct trailer_iterator *iter, const char *msg)
strbuf_init(&iter->key, 0);
strbuf_init(&iter->val, 0);
opts.no_divider = 1;
- trailer_info_get(&iter->internal.info, msg, &opts);
+ trailer_info_get(&opts, msg, &iter->internal.info);
iter->internal.cur = 0;
}