]> git.ipfire.org Git - thirdparty/git.git/blob - line-log.h
Merge branch 'jc/index-pack-fsck-levels'
[thirdparty/git.git] / line-log.h
1 #ifndef LINE_LOG_H
2 #define LINE_LOG_H
3
4 struct rev_info;
5 struct commit;
6 struct string_list;
7
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;
12 };
13
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;
18 };
19
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;
25 };
26
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);
33 /*
34 * In-place pass of sorting and merging the ranges in the range set,
35 * to sort and make the ranges disjoint.
36 */
37 void sort_and_merge_range_set(struct range_set *);
38
39 /* Linked list of interesting files and their associated ranges. The
40 * list must be kept sorted by path.
41 *
42 * For simplicity, even though this is highly redundant, each
43 * line_log_data owns its 'path'.
44 */
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;
51 };
52
53 void line_log_init(struct rev_info *rev, const char *prefix, struct string_list *args);
54
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);
58
59 int line_log_print(struct rev_info *rev, struct commit *commit);
60
61 void line_log_free(struct rev_info *rev);
62
63 #endif /* LINE_LOG_H */