1#ifndef TRAILER_H
2#define TRAILER_H
34
#include "list.h"
56
enum trailer_where {
7WHERE_END,
8WHERE_AFTER,
9WHERE_BEFORE,
10WHERE_START
11};
12enum trailer_if_exists {
13EXISTS_ADD_IF_DIFFERENT_NEIGHBOR,
14EXISTS_ADD_IF_DIFFERENT,
15EXISTS_ADD,
16EXISTS_REPLACE,
17EXISTS_DO_NOTHING
18};
19enum trailer_if_missing {
20MISSING_ADD,
21MISSING_DO_NOTHING
22};
2324
int trailer_set_where(enum trailer_where *item, const char *value);
25int trailer_set_if_exists(enum trailer_if_exists *item, const char *value);
26int trailer_set_if_missing(enum trailer_if_missing *item, const char *value);
2728
struct trailer_info {
29/*
30* True if there is a blank line before the location pointed to by
31* trailer_start.
32*/
33int blank_line_before_trailer;
3435
/*
36* Pointers to the start and end of the trailer block found. If there
37* is no trailer block found, these 2 pointers point to the end of the
38* input string.
39*/
40const char *trailer_start, *trailer_end;
4142
/*
43* Array of trailers found.
44*/
45char **trailers;
46size_t trailer_nr;
47};
4849
/*
50* A list that represents newly-added trailers, such as those provided
51* with the --trailer command line option of git-interpret-trailers.
52*/
53struct new_trailer_item {
54struct list_head list;
5556
const char *text;
57};
5859
void process_trailers(const char *file, int in_place, int trim_empty,
60struct list_head *new_trailer_head);
6162
void trailer_info_get(struct trailer_info *info, const char *str);
6364
void trailer_info_release(struct trailer_info *info);
6566
#endif /* TRAILER_H */