mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
0383dc5629
commit
ae0ec2e0e0
20
trailer.h
20
trailer.h
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user