| 1 | #ifndef LINE_LOG_H |
| 2 | #define LINE_LOG_H |
| 3 | |
| 4 | #include "diffcore.h" /* struct range, struct range_set */ |
| 5 | |
| 6 | struct rev_info; |
| 7 | struct commit; |
| 8 | struct string_list; |
| 9 | |
| 10 | /* A diff, encoded as the set of pre- and post-image ranges where the |
| 11 | * files differ. A pair of ranges corresponds to a hunk. */ |
| 12 | struct diff_ranges { |
| 13 | struct range_set parent; |
| 14 | struct range_set target; |
| 15 | }; |
| 16 | |
| 17 | void range_set_init(struct range_set *, size_t prealloc); |
| 18 | void range_set_release(struct range_set *); |
| 19 | /* Range includes start; excludes end */ |
| 20 | void range_set_append_unsafe(struct range_set *, long start, long end); |
| 21 | /* New range must begin at or after end of last added range */ |
| 22 | void range_set_append(struct range_set *, long start, long end); |
| 23 | /* |
| 24 | * In-place pass of sorting and merging the ranges in the range set, |
| 25 | * to sort and make the ranges disjoint. |
| 26 | */ |
| 27 | void sort_and_merge_range_set(struct range_set *); |
| 28 | |
| 29 | /* Linked list of interesting files and their associated ranges. The |
| 30 | * list must be kept sorted by path. |
| 31 | * |
| 32 | * For simplicity, even though this is highly redundant, each |
| 33 | * line_log_data owns its 'path'. |
| 34 | */ |
| 35 | struct line_log_data { |
| 36 | struct line_log_data *next; |
| 37 | char *path; |
| 38 | struct range_set ranges; |
| 39 | struct diff_filepair *pair; |
| 40 | struct diff_ranges diff; |
| 41 | }; |
| 42 | |
| 43 | void line_log_init(struct rev_info *rev, const char *prefix, struct string_list *args); |
| 44 | |
| 45 | int line_log_filter(struct rev_info *rev); |
| 46 | int line_log_process_ranges_arbitrary_commit(struct rev_info *rev, |
| 47 | struct commit *commit); |
| 48 | |
| 49 | void line_log_queue_pairs(struct rev_info *rev, struct commit *commit); |
| 50 | |
| 51 | void line_log_free(struct rev_info *rev); |
| 52 | |
| 53 | #endif /* LINE_LOG_H */ |