repository: create read_replace_refs setting
[alt-git.git] / line-log.h
blobadff361b1bc93905641341df88a7cfcbfb6c118d
1 #ifndef LINE_LOG_H
2 #define LINE_LOG_H
4 #include "diffcore.h"
6 struct rev_info;
7 struct commit;
8 struct string_list;
10 /* A range [start,end]. Lines are numbered starting at 0, and the
11 * ranges include start but exclude end. */
12 struct range {
13 long start, end;
16 /* A set of ranges. The ranges must always be disjoint and sorted. */
17 struct range_set {
18 unsigned int alloc, nr;
19 struct range *ranges;
22 /* A diff, encoded as the set of pre- and post-image ranges where the
23 * files differ. A pair of ranges corresponds to a hunk. */
24 struct diff_ranges {
25 struct range_set parent;
26 struct range_set target;
29 void range_set_init(struct range_set *, size_t prealloc);
30 void range_set_release(struct range_set *);
31 /* Range includes start; excludes end */
32 void range_set_append_unsafe(struct range_set *, long start, long end);
33 /* New range must begin at or after end of last added range */
34 void range_set_append(struct range_set *, long start, long end);
36 * In-place pass of sorting and merging the ranges in the range set,
37 * to sort and make the ranges disjoint.
39 void sort_and_merge_range_set(struct range_set *);
41 /* Linked list of interesting files and their associated ranges. The
42 * list must be kept sorted by path.
44 * For simplicity, even though this is highly redundant, each
45 * line_log_data owns its 'path'.
47 struct line_log_data {
48 struct line_log_data *next;
49 char *path;
50 struct range_set ranges;
51 struct diff_filepair *pair;
52 struct diff_ranges diff;
55 void line_log_init(struct rev_info *rev, const char *prefix, struct string_list *args);
57 int line_log_filter(struct rev_info *rev);
58 int line_log_process_ranges_arbitrary_commit(struct rev_info *rev,
59 struct commit *commit);
61 int line_log_print(struct rev_info *rev, struct commit *commit);
63 #endif /* LINE_LOG_H */