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 GIT_BLAME_FIRST_PARENT = (1<<4), 16 } 17 18 struct git_blame_options { 19 uint version_ = GIT_BLAME_OPTIONS_VERSION; 20 21 uint32_t flags; 22 uint16_t min_match_characters; 23 git_oid newest_commit; 24 git_oid oldest_commit; 25 size_t min_line; 26 size_t max_line; 27 } 28 29 enum GIT_BLAME_OPTIONS_VERSION = 1; 30 enum git_blame_options GIT_BLAME_OPTIONS_INIT = {GIT_BLAME_OPTIONS_VERSION}; 31 32 int git_blame_init_options( 33 git_blame_options *opts, 34 uint version_); 35 36 37 struct git_blame_hunk { 38 size_t lines_in_hunk; 39 40 git_oid final_commit_id; 41 size_t final_start_line_number; 42 git_signature *final_signature; 43 44 git_oid orig_commit_id; 45 const(char) *orig_path; 46 size_t orig_start_line_number; 47 git_signature *orig_signature; 48 49 byte boundary; 50 } 51 52 struct git_blame { 53 @disable this(); 54 @disable this(this); 55 } 56 57 uint32_t git_blame_get_hunk_count(git_blame *blame); 58 const(git_blame_hunk)* git_blame_get_hunk_byindex(git_blame *blame, uint32_t index); 59 const(git_blame_hunk)* git_blame_get_hunk_byline(git_blame *blame, size_t lineno); 60 int git_blame_file(git_blame **out_, git_repository *repo, const(char)* path, git_blame_options *options); 61 int git_blame_buffer(git_blame **out_, git_blame *reference, const(char)* buffer, size_t buffer_len); 62 void git_blame_free(git_blame *blame);