reftable/stack: do not die when fsyncing lock file files
[git/gitster.git] / line-log.h
blobe9dadbc1a58e2c657511b03f289994143b62bbfb
1 #ifndef LINE_LOG_H
2 #define LINE_LOG_H
4 struct rev_info;
5 struct commit;
6 struct string_list;
8 /* A range [start,end]. Lines are numbered starting at 0, and the
9 * ranges include start but exclude end. */
10 struct range {
11 long start, end;
14 /* A set of ranges. The ranges must always be disjoint and sorted. */
15 struct range_set {
16 unsigned int alloc, nr;
17 struct range *ranges;
20 /* A diff, encoded as the set of pre- and post-image ranges where the
21 * files differ. A pair of ranges corresponds to a hunk. */
22 struct diff_ranges {
23 struct range_set parent;
24 struct range_set target;
27 void range_set_init(struct range_set *, size_t prealloc);
28 void range_set_release(struct range_set *);
29 /* Range includes start; excludes end */
30 void range_set_append_unsafe(struct range_set *, long start, long end);
31 /* New range must begin at or after end of last added range */
32 void range_set_append(struct range_set *, long start, long end);
34 * In-place pass of sorting and merging the ranges in the range set,
35 * to sort and make the ranges disjoint.
37 void sort_and_merge_range_set(struct range_set *);
39 /* Linked list of interesting files and their associated ranges. The
40 * list must be kept sorted by path.
42 * For simplicity, even though this is highly redundant, each
43 * line_log_data owns its 'path'.
45 struct line_log_data {
46 struct line_log_data *next;
47 char *path;
48 struct range_set ranges;
49 struct diff_filepair *pair;
50 struct diff_ranges diff;
53 void line_log_init(struct rev_info *rev, const char *prefix, struct string_list *args);
55 int line_log_filter(struct rev_info *rev);
56 int line_log_process_ranges_arbitrary_commit(struct rev_info *rev,
57 struct commit *commit);
59 int line_log_print(struct rev_info *rev, struct commit *commit);
61 void line_log_free(struct rev_info *rev);
63 #endif /* LINE_LOG_H */