pretty: move trailer formatting to trailer.c
[git.git] / trailer.h
bloba172811022f1498bb155246ff8608176275fe889
1 #ifndef TRAILER_H
2 #define TRAILER_H
4 struct trailer_info {
5 /*
6 * True if there is a blank line before the location pointed to by
7 * trailer_start.
8 */
9 int blank_line_before_trailer;
12 * Pointers to the start and end of the trailer block found. If there
13 * is no trailer block found, these 2 pointers point to the end of the
14 * input string.
16 const char *trailer_start, *trailer_end;
19 * Array of trailers found.
21 char **trailers;
22 size_t trailer_nr;
25 struct process_trailer_options {
26 int in_place;
27 int trim_empty;
28 int only_trailers;
29 int only_input;
30 int unfold;
33 #define PROCESS_TRAILER_OPTIONS_INIT {0}
35 void process_trailers(const char *file,
36 const struct process_trailer_options *opts,
37 struct string_list *trailers);
39 void trailer_info_get(struct trailer_info *info, const char *str);
41 void trailer_info_release(struct trailer_info *info);
44 * Format the trailers from the commit msg "msg" into the strbuf "out".
45 * Note two caveats about "opts":
47 * - this is primarily a helper for pretty.c, and not
48 * all of the flags are supported.
50 * - this differs from process_trailers slightly in that we always format
51 * only the trailer block itself, even if the "only_trailers" option is not
52 * set.
54 void format_trailers_from_commit(struct strbuf *out, const char *msg,
55 const struct process_trailer_options *opts);
57 #endif /* TRAILER_H */