1#ifndef TRAILER_H
2#define TRAILER_H
34
#include "list.h"
56
enum trailer_where {
7WHERE_DEFAULT,
8WHERE_END,
9WHERE_AFTER,
10WHERE_BEFORE,
11WHERE_START
12};
13enum trailer_if_exists {
14EXISTS_DEFAULT,
15EXISTS_ADD_IF_DIFFERENT_NEIGHBOR,
16EXISTS_ADD_IF_DIFFERENT,
17EXISTS_ADD,
18EXISTS_REPLACE,
19EXISTS_DO_NOTHING
20};
21enum trailer_if_missing {
22MISSING_DEFAULT,
23MISSING_ADD,
24MISSING_DO_NOTHING
25};
2627
int trailer_set_where(enum trailer_where *item, const char *value);
28int trailer_set_if_exists(enum trailer_if_exists *item, const char *value);
29int trailer_set_if_missing(enum trailer_if_missing *item, const char *value);
3031
struct trailer_info {
32/*
33* True if there is a blank line before the location pointed to by
34* trailer_start.
35*/
36int blank_line_before_trailer;
3738
/*
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*/
43const char *trailer_start, *trailer_end;
4445
/*
46* Array of trailers found.
47*/
48char **trailers;
49size_t trailer_nr;
50};
5152
/*
53* A list that represents newly-added trailers, such as those provided
54* with the --trailer command line option of git-interpret-trailers.
55*/
56struct new_trailer_item {
57struct list_head list;
5859
const char *text;
6061
enum trailer_where where;
62enum trailer_if_exists if_exists;
63enum trailer_if_missing if_missing;
64};
6566
void process_trailers(const char *file, int in_place, int trim_empty,
67struct list_head *new_trailer_head);
6869
void trailer_info_get(struct trailer_info *info, const char *str);
7071
void trailer_info_release(struct trailer_info *info);
7273
#endif /* TRAILER_H */