1 module deimos.git2.remote; 2 3 import deimos.git2.buffer; 4 import deimos.git2.common; 5 import deimos.git2.indexer; 6 import deimos.git2.net; 7 import deimos.git2.oid; 8 import deimos.git2.pack; 9 import deimos.git2.push; 10 import deimos.git2.proxy; 11 import deimos.git2.refspec; 12 import deimos.git2.repository; 13 import deimos.git2.strarray; 14 import deimos.git2.util; 15 import deimos.git2.transport; 16 import deimos.git2.types; 17 18 extern (C): 19 20 int git_remote_create( 21 git_remote **out_, 22 git_repository *repo, 23 const(char)* name, 24 const(char)* url); 25 int git_remote_create_with_fetchspec( 26 git_remote **out_, 27 git_repository *repo, 28 const(char)* name, 29 const(char)* url, 30 const(char)* fetch); 31 int git_remote_create_anonymous( 32 git_remote **out_, 33 git_repository *repo, 34 const(char)* url); 35 int git_remote_lookup(git_remote **out_, git_repository* repo, const(char)* name); 36 int git_remote_dup(git_remote **dest, git_remote* source); 37 git_repository* git_remote_owner(const(git_remote)* remote); 38 const(char)* git_remote_name(const(git_remote)* remote); 39 const(char)* git_remote_url(const(git_remote)* remote); 40 const(char)* git_remote_pushurl(const(git_remote)* remote); 41 int git_remote_set_url(git_repository* repo, const(char)* remote, const(char)* url); 42 int git_remote_set_pushurl(git_repository* repo, const(char)* remote, const(char)* url); 43 int git_remote_add_fetch(git_repository* repo, const(char)* remote, const(char)* refspec); 44 int git_remote_get_fetch_refspecs(git_strarray* array, const(git_remote)* remote); 45 int git_remote_add_push(git_repository* repo, const(char)* remote, const(char)* refspec); 46 int git_remote_get_push_refspecs(git_strarray* array, const(git_remote)* remote); 47 size_t git_remote_refspec_count(const(git_remote)* remote); 48 const(git_refspec)* git_remote_get_refspec(const(git_remote)* remote, size_t n); 49 int git_remote_connect( 50 git_remote* remote, 51 git_direction direction, 52 const(git_remote_callbacks)* callbacks, 53 const(git_proxy_options)* proxy_opts, 54 const(git_strarray)* custom_headers); 55 int git_remote_ls(const(git_remote_head)*** out_, size_t *size, git_remote *remote); 56 int git_remote_connected(const(git_remote)* remote); 57 void git_remote_stop(git_remote *remote); 58 void git_remote_disconnect(git_remote *remote); 59 void git_remote_free(git_remote *remote); 60 int git_remote_list(git_strarray *out_, git_repository *repo); 61 62 enum git_remote_completion_type { 63 GIT_REMOTE_COMPLETION_DOWNLOAD, 64 GIT_REMOTE_COMPLETION_INDEXING, 65 GIT_REMOTE_COMPLETION_ERROR, 66 } 67 mixin _ExportEnumMembers!git_remote_completion_type; 68 69 alias git_push_transfer_progress = int function( 70 uint current, 71 uint total, 72 size_t bytes, 73 void* payload); 74 75 struct git_push_update { 76 char* src_refname; 77 char* dst_refname; 78 git_oid src; 79 git_oid dst; 80 } 81 82 alias git_push_negotiation = int function(const(git_push_update) **updates, size_t len, void* payload); 83 84 struct git_remote_callbacks { 85 uint version_ = GIT_REMOTE_CALLBACKS_VERSION; 86 git_transport_message_cb sideband_progress; 87 int function(git_remote_completion_type type, void *data) completion; 88 git_cred_acquire_cb credentials; 89 git_transport_certificate_check_cb certificate_check; 90 git_transfer_progress_cb transfer_progress; 91 int function(const(char)* refname, const(git_oid)* a, const(git_oid)* b, void *data) update_tips; 92 git_packbuilder_progress pack_progress; 93 git_push_transfer_progress push_transfer_progress; 94 int function(const(char)* refname, const(char)* status, void* data) push_update_reference; 95 git_push_negotiation push_negotiation; 96 git_transport_cb transport; 97 void *payload; 98 } 99 100 101 int git_remote_init_callbacks(git_remote_callbacks *opts, uint version_); 102 103 enum git_fetch_prune_t { 104 GIT_FETCH_PRUNE_UNSPECIFIED, 105 GIT_FETCH_PRUNE, 106 GIT_FETCH_NO_PRUNE, 107 } 108 mixin _ExportEnumMembers!git_fetch_prune_t; 109 110 enum git_remote_autotag_option_t { 111 GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED = 0, 112 GIT_REMOTE_DOWNLOAD_TAGS_AUTO, 113 GIT_REMOTE_DOWNLOAD_TAGS_NONE, 114 GIT_REMOTE_DOWNLOAD_TAGS_ALL, 115 } 116 mixin _ExportEnumMembers!git_remote_autotag_option_t; 117 118 struct git_fetch_options { 119 int version_; 120 git_remote_callbacks callbacks; 121 git_fetch_prune_t prune; 122 123 int update_fetchhead; 124 125 git_remote_autotag_option_t download_tags; 126 git_proxy_options proxy_opts; 127 git_strarray custom_headers; 128 } 129 enum GIT_FETCH_OPTIONS_VERSION = 1; 130 enum git_fetch_options GIT_FETCH_OPTIONS_INIT = { 131 GIT_FETCH_OPTIONS_VERSION, 132 GIT_REMOTE_CALLBACKS_INIT, 133 GIT_FETCH_PRUNE_UNSPECIFIED, 1, 134 GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED, 135 GIT_PROXY_OPTIONS_INIT 136 }; 137 138 int git_push_init_options( 139 git_push_options* opts, 140 uint version_); 141 142 int git_remote_download(git_remote* remote, const(git_strarray)* refspecs, const(git_fetch_options)* opts); 143 int git_remote_upload(git_remote* remote, const(git_strarray)* refspecs, const(git_push_options)* opts); 144 int git_remote_update_tips( 145 git_remote* remote, 146 const(git_remote_callbacks)* callbacks, 147 int update_fetchhead, 148 git_remote_autotag_option_t download_tags, 149 const(char)* reflog_message); 150 151 enum GIT_REMOTE_CALLBACKS_VERSION = 1; 152 enum git_remote_callbacks GIT_REMOTE_CALLBACKS_INIT = { GIT_REMOTE_CALLBACKS_VERSION }; 153 154 int git_remote_fetch( 155 git_remote* remote, 156 const(git_strarray)* refspecs, 157 const(git_fetch_options)* opts, 158 const(char)* reflog_message); 159 160 int git_remote_prune(git_remote* remote, const(git_remote_callbacks)* callbacks); 161 int git_remote_push(git_remote* remote, const(git_strarray)* refspecs, const(git_push_options)* opts); 162 163 164 const(git_transfer_progress)* git_remote_stats(git_remote *remote); 165 166 git_remote_autotag_option_t git_remote_autotag(const(git_remote)* remote); 167 int git_remote_set_autotag(git_repository* repo, const(char)* remote, git_remote_autotag_option_t value); 168 int git_remote_prune_refs(const(git_remote)* remote); 169 int git_remote_rename( 170 git_strarray* problems, 171 git_repository* repo, 172 const(char)* name, 173 const(char)* new_name); 174 175 int git_remote_is_valid_name(const(char)* remote_name); 176 int git_remote_delete(git_repository* repo, const(char)* name); 177 int git_remote_default_branch(git_buf* out_, git_remote* remote);