1 module deimos.git2.index; 2 3 import deimos.git2.common; 4 import deimos.git2.indexer; 5 import deimos.git2.oid; 6 import deimos.git2.strarray; 7 import deimos.git2.util; 8 import deimos.git2.types; 9 10 extern (C): 11 12 struct git_index_time { 13 git_time_t seconds; 14 uint nanoseconds; 15 } 16 17 struct git_index_entry { 18 git_index_time ctime; 19 git_index_time mtime; 20 21 uint dev; 22 uint ino; 23 uint mode; 24 uint uid; 25 uint gid; 26 git_off_t file_size; 27 28 git_oid oid; 29 30 ushort flags; 31 ushort flags_extended; 32 33 char *path; 34 } 35 36 enum GIT_IDXENTRY_NAMEMASK = (0x0fff); 37 enum GIT_IDXENTRY_STAGEMASK = (0x3000); 38 enum GIT_IDXENTRY_EXTENDED = (0x4000); 39 enum GIT_IDXENTRY_VALID = (0x8000); 40 enum GIT_IDXENTRY_STAGESHIFT = 12; 41 42 auto GIT_IDXENTRY_STAGE(T)(T E) { return (((E).flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT); } 43 44 enum GIT_IDXENTRY_INTENT_TO_ADD = (1 << 13); 45 enum GIT_IDXENTRY_SKIP_WORKTREE = (1 << 14); 46 enum GIT_IDXENTRY_EXTENDED2 = (1 << 15); 47 enum GIT_IDXENTRY_EXTENDED_FLAGS = (GIT_IDXENTRY_INTENT_TO_ADD | GIT_IDXENTRY_SKIP_WORKTREE); 48 49 enum GIT_IDXENTRY_UPDATE = (1 << 0); 50 enum GIT_IDXENTRY_REMOVE = (1 << 1); 51 enum GIT_IDXENTRY_UPTODATE = (1 << 2); 52 enum GIT_IDXENTRY_ADDED = (1 << 3); 53 54 enum GIT_IDXENTRY_HASHED = (1 << 4); 55 enum GIT_IDXENTRY_UNHASHED = (1 << 5); 56 enum GIT_IDXENTRY_WT_REMOVE = (1 << 6); 57 enum GIT_IDXENTRY_CONFLICTED = (1 << 7); 58 59 enum GIT_IDXENTRY_UNPACKED = (1 << 8); 60 enum GIT_IDXENTRY_NEW_SKIP_WORKTREE = (1 << 9); 61 62 enum git_indexcap_t { 63 GIT_INDEXCAP_IGNORE_CASE = 1u, 64 GIT_INDEXCAP_NO_FILEMODE = 2u, 65 GIT_INDEXCAP_NO_SYMLINKS = 4u, 66 GIT_INDEXCAP_FROM_OWNER = ~0u 67 } 68 mixin _ExportEnumMembers!git_indexcap_t; 69 70 alias git_index_matched_path_cb = int function( 71 const(char)* path, const(char)* matched_pathspec, void *payload); 72 73 enum git_index_add_option_t { 74 GIT_INDEX_ADD_DEFAULT = 0, 75 GIT_INDEX_ADD_FORCE = (1u << 0), 76 GIT_INDEX_ADD_DISABLE_PATHSPEC_MATCH = (1u << 1), 77 GIT_INDEX_ADD_CHECK_PATHSPEC = (1u << 2), 78 } 79 mixin _ExportEnumMembers!git_index_add_option_t; 80 81 enum GIT_INDEX_STAGE_ANY = -1; 82 83 int git_index_open(git_index **out_, const(char)* index_path); 84 int git_index_new(git_index **out_); 85 void git_index_free(git_index *index); 86 git_repository * git_index_owner(const(git_index)* index); 87 uint git_index_caps(const(git_index)* index); 88 int git_index_set_caps(git_index *index, uint caps); 89 int git_index_read(git_index *index, int force); 90 int git_index_write(git_index *index); 91 const(char)* git_index_path(git_index *index); 92 int git_index_read_tree(git_index *index, const(git_tree)* tree); 93 int git_index_write_tree(git_oid *out_, git_index *index); 94 int git_index_write_tree_to(git_oid *out_, git_index *index, git_repository *repo); 95 size_t git_index_entrycount(const(git_index)* index); 96 void git_index_clear(git_index *index); 97 const(git_index_entry)* git_index_get_byindex( 98 git_index *index, size_t n); 99 const(git_index_entry)* git_index_get_bypath( 100 git_index *index, const(char)* path, int stage); 101 int git_index_remove(git_index *index, const(char)* path, int stage); 102 int git_index_remove_directory( 103 git_index *index, const(char)* dir, int stage); 104 int git_index_add(git_index *index, const(git_index_entry)* source_entry); 105 int git_index_entry_stage(const(git_index_entry)* entry); 106 int git_index_add_bypath(git_index *index, const(char)* path); 107 int git_index_remove_bypath(git_index *index, const(char)* path); 108 int git_index_add_all( 109 git_index *index, 110 const(git_strarray)* pathspec, 111 uint flags, 112 git_index_matched_path_cb callback, 113 void *payload); 114 int git_index_remove_all( 115 git_index *index, 116 const(git_strarray)* pathspec, 117 git_index_matched_path_cb callback, 118 void *payload); 119 int git_index_update_all( 120 git_index *index, 121 const(git_strarray)* pathspec, 122 git_index_matched_path_cb callback, 123 void *payload); 124 int git_index_find(size_t *at_pos, git_index *index, const(char)* path); 125 int git_index_conflict_add( 126 git_index *index, 127 const(git_index_entry)* ancestor_entry, 128 const(git_index_entry)* our_entry, 129 const(git_index_entry)* their_entry); 130 int git_index_conflict_get( 131 const(git_index_entry)** ancestor_out, 132 const(git_index_entry)** our_out, 133 const(git_index_entry)** their_out, 134 git_index *index, 135 const(char)* path); 136 int git_index_conflict_remove(git_index *index, const(char)* path); 137 void git_index_conflict_cleanup(git_index *index); 138 int git_index_has_conflicts(const(git_index)* index); 139 int git_index_conflict_iterator_new( 140 git_index_conflict_iterator **iterator_out, 141 git_index *index); 142 int git_index_conflict_next( 143 const(git_index_entry)** ancestor_out, 144 const(git_index_entry)** our_out, 145 const(git_index_entry)** their_out, 146 git_index_conflict_iterator *iterator); 147 void git_index_conflict_iterator_free( 148 git_index_conflict_iterator *iterator);