1 module deimos.git2.blame;
2 
3 import deimos.git2.common;
4 import deimos.git2.oid;
5 import deimos.git2.types;
6 
7 extern(C):
8 
9 enum git_blame_flag_t {
10 	GIT_BLAME_NORMAL = 0,
11 	GIT_BLAME_TRACK_COPIES_SAME_FILE = (1<<0),
12 	GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES = (1<<1),
13 	GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES = (1<<2),
14 	GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES = (1<<3),
15 }
16 
17 struct git_blame_options {
18 	uint version_ = GIT_BLAME_OPTIONS_VERSION;
19 
20 	uint32_t flags;
21 	uint16_t min_match_characters;
22 	git_oid newest_commit;
23 	git_oid oldest_commit;
24 	uint32_t min_line;
25 	uint32_t max_line;
26 }
27 
28 enum GIT_BLAME_OPTIONS_VERSION = 1;
29 enum git_blame_options GIT_BLAME_OPTIONS_INIT = {GIT_BLAME_OPTIONS_VERSION};
30 
31 struct git_blame_hunk {
32 	uint16_t lines_in_hunk;
33 
34 	git_oid final_commit_id;
35 	uint16_t final_start_line_number;
36 	git_signature *final_signature;
37 
38 	git_oid orig_commit_id;
39 	const(char) *orig_path;
40 	uint16_t orig_start_line_number;
41 	git_signature *orig_signature;
42 
43 	byte boundary;
44 }
45 
46 struct git_blame {
47 	@disable this();
48 	@disable this(this);
49 }
50 
51 uint32_t git_blame_get_hunk_count(git_blame *blame);
52 const(git_blame_hunk)* git_blame_get_hunk_byindex(git_blame *blame, uint32_t index);
53 const(git_blame_hunk)* git_blame_get_hunk_byline(git_blame *blame, uint32_t lineno);
54 int git_blame_file(git_blame **out_, git_repository *repo, const(char)* path, git_blame_options *options);
55 int git_blame_buffer(git_blame **out_, git_blame *reference, const(char)* buffer, uint32_t buffer_len);
56 void git_blame_free(git_blame *blame);