1 module deimos.git2.status; 2 3 import deimos.git2.common; 4 import deimos.git2.diff; 5 import deimos.git2.strarray; 6 import deimos.git2.util; 7 import deimos.git2.types; 8 9 extern (C): 10 11 enum git_status_t { 12 GIT_STATUS_CURRENT = 0, 13 14 GIT_STATUS_INDEX_NEW = (1u << 0), 15 GIT_STATUS_INDEX_MODIFIED = (1u << 1), 16 GIT_STATUS_INDEX_DELETED = (1u << 2), 17 GIT_STATUS_INDEX_RENAMED = (1u << 3), 18 GIT_STATUS_INDEX_TYPECHANGE = (1u << 4), 19 20 GIT_STATUS_WT_NEW = (1u << 7), 21 GIT_STATUS_WT_MODIFIED = (1u << 8), 22 GIT_STATUS_WT_DELETED = (1u << 9), 23 GIT_STATUS_WT_TYPECHANGE = (1u << 10), 24 GIT_STATUS_WT_RENAMED = (1u << 11), 25 26 GIT_STATUS_IGNORED = (1u << 14), 27 } 28 mixin _ExportEnumMembers!git_status_t; 29 30 alias git_status_cb = int function( 31 const(char)* path, uint status_flags, void *payload); 32 33 enum git_status_show_t { 34 GIT_STATUS_SHOW_INDEX_AND_WORKDIR = 0, 35 GIT_STATUS_SHOW_INDEX_ONLY = 1, 36 GIT_STATUS_SHOW_WORKDIR_ONLY = 2, 37 } 38 mixin _ExportEnumMembers!git_status_show_t; 39 40 enum git_status_opt_t { 41 GIT_STATUS_OPT_INCLUDE_UNTRACKED = (1u << 0), 42 GIT_STATUS_OPT_INCLUDE_IGNORED = (1u << 1), 43 GIT_STATUS_OPT_INCLUDE_UNMODIFIED = (1u << 2), 44 GIT_STATUS_OPT_EXCLUDE_SUBMODULES = (1u << 3), 45 GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS = (1u << 4), 46 GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH = (1u << 5), 47 GIT_STATUS_OPT_RECURSE_IGNORED_DIRS = (1u << 6), 48 GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX = (1u << 7), 49 GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR = (1u << 8), 50 GIT_STATUS_OPT_SORT_CASE_SENSITIVELY = (1u << 9), 51 GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY = (1u << 10), 52 GIT_STATUS_OPT_RENAMES_FROM_REWRITES = (1u << 11), 53 GIT_STATUS_OPT_NO_REFRESH = (1u << 12), 54 } 55 mixin _ExportEnumMembers!git_status_opt_t; 56 57 enum GIT_STATUS_OPT_DEFAULTS = 58 (git_status_opt_t.GIT_STATUS_OPT_INCLUDE_IGNORED | 59 git_status_opt_t.GIT_STATUS_OPT_INCLUDE_UNTRACKED | 60 git_status_opt_t.GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS); 61 62 struct git_status_options { 63 uint version_; 64 git_status_show_t show; 65 uint flags; 66 git_strarray pathspec; 67 } 68 69 enum GIT_STATUS_OPTIONS_VERSION = 1; 70 enum git_status_options GIT_STATUS_OPTIONS_INIT = { GIT_STATUS_OPTIONS_VERSION }; 71 72 struct git_status_entry { 73 git_status_t status; 74 git_diff_delta *head_to_index; 75 git_diff_delta *index_to_workdir; 76 } 77 78 int git_status_foreach( 79 git_repository *repo, 80 git_status_cb callback, 81 void *payload); 82 int git_status_foreach_ext( 83 git_repository *repo, 84 const(git_status_options)* opts, 85 git_status_cb callback, 86 void *payload); 87 int git_status_file( 88 uint *status_flags, 89 git_repository *repo, 90 const(char)* path); 91 int git_status_list_new( 92 git_status_list **out_, 93 git_repository *repo, 94 const(git_status_options)* opts); 95 size_t git_status_list_entrycount( 96 git_status_list *statuslist); 97 const(git_status_entry)* git_status_byindex( 98 git_status_list *statuslist, 99 size_t idx); 100 void git_status_list_free( 101 git_status_list *statuslist); 102 int git_status_should_ignore( 103 int *ignored, 104 git_repository *repo, 105 const(char)* path);