]>
Commit | Line | Data |
---|---|---|
b1d78d77 CC |
1 | #ifndef TRAILER_H |
2 | #define TRAILER_H | |
3 | ||
51166b87 PB |
4 | #include "list.h" |
5 | ||
52fc319d | 6 | enum trailer_where { |
0ea5292e | 7 | WHERE_DEFAULT, |
52fc319d PB |
8 | WHERE_END, |
9 | WHERE_AFTER, | |
10 | WHERE_BEFORE, | |
11 | WHERE_START | |
12 | }; | |
13 | enum trailer_if_exists { | |
0ea5292e | 14 | EXISTS_DEFAULT, |
52fc319d PB |
15 | EXISTS_ADD_IF_DIFFERENT_NEIGHBOR, |
16 | EXISTS_ADD_IF_DIFFERENT, | |
17 | EXISTS_ADD, | |
18 | EXISTS_REPLACE, | |
19 | EXISTS_DO_NOTHING | |
20 | }; | |
21 | enum trailer_if_missing { | |
0ea5292e | 22 | MISSING_DEFAULT, |
52fc319d PB |
23 | MISSING_ADD, |
24 | MISSING_DO_NOTHING | |
25 | }; | |
26 | ||
27 | int trailer_set_where(enum trailer_where *item, const char *value); | |
28 | int trailer_set_if_exists(enum trailer_if_exists *item, const char *value); | |
29 | int trailer_set_if_missing(enum trailer_if_missing *item, const char *value); | |
30 | ||
e8c352c3 JT |
31 | struct trailer_info { |
32 | /* | |
33 | * True if there is a blank line before the location pointed to by | |
34 | * trailer_start. | |
35 | */ | |
36 | int blank_line_before_trailer; | |
37 | ||
38 | /* | |
39 | * Pointers to the start and end of the trailer block found. If there | |
40 | * is no trailer block found, these 2 pointers point to the end of the | |
41 | * input string. | |
42 | */ | |
43 | const char *trailer_start, *trailer_end; | |
44 | ||
45 | /* | |
46 | * Array of trailers found. | |
47 | */ | |
48 | char **trailers; | |
49 | size_t trailer_nr; | |
50 | }; | |
51 | ||
51166b87 PB |
52 | /* |
53 | * A list that represents newly-added trailers, such as those provided | |
54 | * with the --trailer command line option of git-interpret-trailers. | |
55 | */ | |
56 | struct new_trailer_item { | |
57 | struct list_head list; | |
58 | ||
59 | const char *text; | |
0ea5292e PB |
60 | |
61 | enum trailer_where where; | |
62 | enum trailer_if_exists if_exists; | |
63 | enum trailer_if_missing if_missing; | |
51166b87 PB |
64 | }; |
65 | ||
e1f89863 | 66 | void process_trailers(const char *file, int in_place, int trim_empty, |
51166b87 | 67 | struct list_head *new_trailer_head); |
b1d78d77 | 68 | |
e8c352c3 JT |
69 | void trailer_info_get(struct trailer_info *info, const char *str); |
70 | ||
71 | void trailer_info_release(struct trailer_info *info); | |
72 | ||
b1d78d77 | 73 | #endif /* TRAILER_H */ |