summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorLinus Arver <linusa@google.com>2024-03-01 00:14:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2024-03-01 18:35:42 (GMT)
commit0383dc5629dc4416b6564e5b458d174d770ef191 (patch)
tree3da5fa58241dd636e6c0fcef7bb3f1e25142af73 /pretty.c
parent7b1c6aa541cc94796e9148e5e49c4d2f787e953d (diff)
downloadgit-0383dc5629dc4416b6564e5b458d174d770ef191.zip
git-0383dc5629dc4416b6564e5b458d174d770ef191.tar.gz
git-0383dc5629dc4416b6564e5b458d174d770ef191.tar.bz2
trailer: reorder format_trailers_from_commit() parameters
Currently there are two functions for formatting trailers in <trailer.h>: void format_trailers(const struct process_trailer_options *, struct list_head *trailers, FILE *outfile); void format_trailers_from_commit(struct strbuf *out, const char *msg, const struct process_trailer_options *opts); and although they are similar enough (even taking the same process_trailer_options struct pointer) they are used quite differently. One might intuitively think that format_trailers_from_commit() builds on top of format_trailers(), but this is not the case. Instead format_trailers_from_commit() calls format_trailer_info() and format_trailers() is never called in that codepath. This is a preparatory refactor to help us deprecate format_trailers() in favor of format_trailer_info() (at which point we can rename the latter to the former). When the deprecation is complete, both format_trailers_from_commit(), and the interpret-trailers builtin will be able to call into the same helper function (instead of format_trailers() and format_trailer_info(), respectively). Unifying the formatters is desirable because it simplifies the API. Reorder parameters for format_trailers_from_commit() to prefer const struct process_trailer_options *opts as the first parameter, because these options are intimately tied to formatting trailers. And take struct strbuf *out last, because it's an "out parameter" (something that the caller wants to use as the output of this function). Similarly, reorder parameters for format_trailer_info(), because later on we will unify the two together. Signed-off-by: Linus Arver <linusa@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pretty.c b/pretty.c
index cf964b0..bdbed42 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1759,7 +1759,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
goto trailer_out;
}
if (*arg == ')') {
- format_trailers_from_commit(sb, msg + c->subject_off, &opts);
+ format_trailers_from_commit(&opts, msg + c->subject_off, sb);
ret = arg - placeholder + 1;
}
trailer_out: