Merge branch 'ma/user-manual-markup-update'
[git/git.git] / line-log.h
CommitLineData
12da1d1f
TR
1#ifndef LINE_LOG_H
2#define LINE_LOG_H
3
4#include "diffcore.h"
5
6struct rev_info;
7struct commit;
8
9/* A range [start,end]. Lines are numbered starting at 0, and the
10 * ranges include start but exclude end. */
11struct range {
12 long start, end;
13};
14
15/* A set of ranges. The ranges must always be disjoint and sorted. */
16struct range_set {
071bcaab 17 unsigned int alloc, nr;
12da1d1f
TR
18 struct range *ranges;
19};
20
21/* A diff, encoded as the set of pre- and post-image ranges where the
22 * files differ. A pair of ranges corresponds to a hunk. */
23struct diff_ranges {
24 struct range_set parent;
25 struct range_set target;
26};
27
55454427
DL
28void range_set_init(struct range_set *, size_t prealloc);
29void range_set_release(struct range_set *);
c0babbe6 30/* Range includes start; excludes end */
55454427 31void range_set_append_unsafe(struct range_set *, long start, long end);
c0babbe6 32/* New range must begin at or after end of last added range */
55454427 33void range_set_append(struct range_set *, long start, long end);
c0babbe6
ES
34/*
35 * In-place pass of sorting and merging the ranges in the range set,
36 * to sort and make the ranges disjoint.
37 */
55454427 38void sort_and_merge_range_set(struct range_set *);
c0babbe6 39
12da1d1f 40/* Linked list of interesting files and their associated ranges. The
31c61918
TR
41 * list must be kept sorted by path.
42 *
43 * For simplicity, even though this is highly redundant, each
44 * line_log_data owns its 'path'.
45 */
12da1d1f
TR
46struct line_log_data {
47 struct line_log_data *next;
31c61918 48 char *path;
12da1d1f
TR
49 char status;
50 struct range_set ranges;
51 int arg_alloc, arg_nr;
52 const char **args;
53 struct diff_filepair *pair;
54 struct diff_ranges diff;
55};
56
55454427 57void line_log_init(struct rev_info *rev, const char *prefix, struct string_list *args);
12da1d1f 58
55454427 59int line_log_filter(struct rev_info *rev);
12da1d1f 60
55454427 61int line_log_print(struct rev_info *rev, struct commit *commit);
12da1d1f
TR
62
63#endif /* LINE_LOG_H */