]> git.proxmox.com Git - libgit2.git/blob - src/blame.h
Include stacktrace summary in memory leak output.
[libgit2.git] / src / blame.h
1 #ifndef INCLUDE_blame_h__
2 #define INCLUDE_blame_h__
3
4 #include "git2/blame.h"
5 #include "common.h"
6 #include "vector.h"
7 #include "diff.h"
8 #include "array.h"
9 #include "git2/oid.h"
10
11 /*
12 * One blob in a commit that is being suspected
13 */
14 typedef struct git_blame__origin {
15 int refcnt;
16 struct git_blame__origin *previous;
17 git_commit *commit;
18 git_blob *blob;
19 char path[GIT_FLEX_ARRAY];
20 } git_blame__origin;
21
22 /*
23 * Each group of lines is described by a git_blame__entry; it can be split
24 * as we pass blame to the parents. They form a linked list in the
25 * scoreboard structure, sorted by the target line number.
26 */
27 typedef struct git_blame__entry {
28 struct git_blame__entry *prev;
29 struct git_blame__entry *next;
30
31 /* the first line of this group in the final image;
32 * internally all line numbers are 0 based.
33 */
34 int lno;
35
36 /* how many lines this group has */
37 int num_lines;
38
39 /* the commit that introduced this group into the final image */
40 git_blame__origin *suspect;
41
42 /* true if the suspect is truly guilty; false while we have not
43 * checked if the group came from one of its parents.
44 */
45 bool guilty;
46
47 /* true if the entry has been scanned for copies in the current parent
48 */
49 bool scanned;
50
51 /* the line number of the first line of this group in the
52 * suspect's file; internally all line numbers are 0 based.
53 */
54 int s_lno;
55
56 /* how significant this entry is -- cached to avoid
57 * scanning the lines over and over.
58 */
59 unsigned score;
60
61 /* Whether this entry has been tracked to a boundary commit.
62 */
63 bool is_boundary;
64 } git_blame__entry;
65
66 struct git_blame {
67 char *path;
68 git_repository *repository;
69 git_blame_options options;
70
71 git_vector hunks;
72 git_vector paths;
73
74 git_blob *final_blob;
75 git_array_t(size_t) line_index;
76
77 size_t current_diff_line;
78 git_blame_hunk *current_hunk;
79
80 /* Scoreboard fields */
81 git_commit *final;
82 git_blame__entry *ent;
83 int num_lines;
84 const char *final_buf;
85 git_off_t final_buf_size;
86 };
87
88 git_blame *git_blame__alloc(
89 git_repository *repo,
90 git_blame_options opts,
91 const char *path);
92
93 #endif