diff options
author | Linus Arver <linusa@google.com> | 2024-03-01 00:14:41 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-01 10:35:42 -0800 |
commit | ae0ec2e0e0bb26474f395504c6ed6fef3f59091f (patch) | |
tree | 737f05614fb0b160319e26e4d1f7bd8e7738a896 /trailer.h | |
parent | 0383dc5629dc4416b6564e5b458d174d770ef191 (diff) | |
download | git-ae0ec2e0e0bb26474f395504c6ed6fef3f59091f.tar.gz |
trailer: move interpret_trailers() to interpret-trailers.c
The interpret-trailers.c builtin is the only place we need to call
interpret_trailers(), so move its definition there (together with a few
helper functions called only by it) and remove its external declaration
from <trailer.h>.
Several helper functions that are called by interpret_trailers() remain
in trailer.c because other callers in the same file still call them.
Declare them in <trailer.h> so that interpret_trailers() (now in
builtin/interpret-trailers.c) can continue calling them as a trailer API
user.
This enriches <trailer.h> with a more granular API, which can then be
unit-tested in the future (because interpret_trailers() by itself does
too many things to be able to be easily unit-tested).
Take this opportunity to demote some file-handling functions out of the
trailer API implementation, as these have nothing to do with trailers.
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Linus Arver <linusa@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trailer.h')
-rw-r--r-- | trailer.h | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -81,15 +81,29 @@ struct process_trailer_options { #define PROCESS_TRAILER_OPTIONS_INIT {0} -void interpret_trailers(const struct process_trailer_options *opts, - struct list_head *new_trailer_head, - const char *file); +void parse_trailers_from_config(struct list_head *config_head); + +void parse_trailers_from_command_line_args(struct list_head *arg_head, + struct list_head *new_trailer_head); + +void process_trailers_lists(struct list_head *head, + struct list_head *arg_head); + +void parse_trailers(const struct process_trailer_options *, + struct trailer_info *, + const char *str, + struct list_head *head); void trailer_info_get(struct trailer_info *info, const char *str, const struct process_trailer_options *opts); void trailer_info_release(struct trailer_info *info); +void trailer_config_init(void); +void format_trailers(const struct process_trailer_options *, + struct list_head *trailers, FILE *outfile); +void free_trailers(struct list_head *); + /* * Format the trailers from the commit msg "msg" into the strbuf "out". * Note two caveats about "opts": |