|
| 1 | +#include "php_git2.h" |
| 2 | +#include "php_git2_priv.h" |
| 3 | +#include "branch.h" |
| 4 | + |
| 5 | +/* {{{ proto resource git_branch_create(repo, branch_name, target, force) |
| 6 | +*/ |
| 7 | +PHP_FUNCTION(git_branch_create) |
| 8 | +{ |
| 9 | + zval *repo; |
| 10 | + php_git2_t *_repo; |
| 11 | + char *branch_name = {0}; |
| 12 | + int branch_name_len; |
| 13 | + zval *target; |
| 14 | + php_git2_t *_target; |
| 15 | + long force; |
| 16 | + |
| 17 | + /* TODO(chobie): implement this */ |
| 18 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_create not implemented yet"); |
| 19 | + return; |
| 20 | + |
| 21 | + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 22 | + "rsrl", &repo, &branch_name, &branch_name_len, &target, &force) == FAILURE) { |
| 23 | + return; |
| 24 | + } |
| 25 | + ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 26 | +} |
| 27 | + |
| 28 | +/* {{{ proto long git_branch_delete(branch) |
| 29 | +*/ |
| 30 | +PHP_FUNCTION(git_branch_delete) |
| 31 | +{ |
| 32 | + zval *branch; |
| 33 | + php_git2_t *_branch; |
| 34 | + |
| 35 | + /* TODO(chobie): implement this */ |
| 36 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_delete not implemented yet"); |
| 37 | + return; |
| 38 | + |
| 39 | + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 40 | + "r", &branch) == FAILURE) { |
| 41 | + return; |
| 42 | + } |
| 43 | + ZEND_FETCH_RESOURCE(_branch, php_git2_t*, &branch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 44 | +} |
| 45 | + |
| 46 | +/* {{{ proto resource git_branch_iterator_new(repo, list_flags) |
| 47 | +*/ |
| 48 | +PHP_FUNCTION(git_branch_iterator_new) |
| 49 | +{ |
| 50 | + zval *repo; |
| 51 | + php_git2_t *_repo; |
| 52 | + zval *list_flags; |
| 53 | + php_git2_t *_list_flags; |
| 54 | + |
| 55 | + /* TODO(chobie): implement this */ |
| 56 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_iterator_new not implemented yet"); |
| 57 | + return; |
| 58 | + |
| 59 | + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 60 | + "rr", &repo, &list_flags) == FAILURE) { |
| 61 | + return; |
| 62 | + } |
| 63 | + ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 64 | +} |
| 65 | + |
| 66 | +/* {{{ proto resource git_branch_next(out_type, iter) |
| 67 | +*/ |
| 68 | +PHP_FUNCTION(git_branch_next) |
| 69 | +{ |
| 70 | + zval *out_type; |
| 71 | + php_git2_t *_out_type; |
| 72 | + zval *iter; |
| 73 | + php_git2_t *_iter; |
| 74 | + |
| 75 | + /* TODO(chobie): implement this */ |
| 76 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_next not implemented yet"); |
| 77 | + return; |
| 78 | + |
| 79 | + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 80 | + "rr", &out_type, &iter) == FAILURE) { |
| 81 | + return; |
| 82 | + } |
| 83 | + ZEND_FETCH_RESOURCE(_out_type, php_git2_t*, &out_type, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 84 | +} |
| 85 | + |
| 86 | +/* {{{ proto void git_branch_iterator_free(iter) |
| 87 | +*/ |
| 88 | +PHP_FUNCTION(git_branch_iterator_free) |
| 89 | +{ |
| 90 | + zval *iter; |
| 91 | + php_git2_t *_iter; |
| 92 | + |
| 93 | + /* TODO(chobie): implement this */ |
| 94 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_iterator_free not implemented yet"); |
| 95 | + return; |
| 96 | + |
| 97 | + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 98 | + "r", &iter) == FAILURE) { |
| 99 | + return; |
| 100 | + } |
| 101 | + ZEND_FETCH_RESOURCE(_iter, php_git2_t*, &iter, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 102 | +} |
| 103 | + |
| 104 | +/* {{{ proto resource git_branch_move(branch, new_branch_name, force) |
| 105 | +*/ |
| 106 | +PHP_FUNCTION(git_branch_move) |
| 107 | +{ |
| 108 | + zval *branch; |
| 109 | + php_git2_t *_branch; |
| 110 | + char *new_branch_name = {0}; |
| 111 | + int new_branch_name_len; |
| 112 | + long force; |
| 113 | + |
| 114 | + /* TODO(chobie): implement this */ |
| 115 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_move not implemented yet"); |
| 116 | + return; |
| 117 | + |
| 118 | + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 119 | + "rsl", &branch, &new_branch_name, &new_branch_name_len, &force) == FAILURE) { |
| 120 | + return; |
| 121 | + } |
| 122 | + ZEND_FETCH_RESOURCE(_branch, php_git2_t*, &branch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 123 | +} |
| 124 | + |
| 125 | +/* {{{ proto resource git_branch_lookup(repo, branch_name, branch_type) |
| 126 | +*/ |
| 127 | +PHP_FUNCTION(git_branch_lookup) |
| 128 | +{ |
| 129 | + zval *repo; |
| 130 | + php_git2_t *_repo; |
| 131 | + char *branch_name = {0}; |
| 132 | + int branch_name_len; |
| 133 | + zval *branch_type; |
| 134 | + php_git2_t *_branch_type; |
| 135 | + |
| 136 | + /* TODO(chobie): implement this */ |
| 137 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_lookup not implemented yet"); |
| 138 | + return; |
| 139 | + |
| 140 | + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 141 | + "rsr", &repo, &branch_name, &branch_name_len, &branch_type) == FAILURE) { |
| 142 | + return; |
| 143 | + } |
| 144 | + ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 145 | +} |
| 146 | + |
| 147 | +/* {{{ proto resource git_branch_name(ref) |
| 148 | +*/ |
| 149 | +PHP_FUNCTION(git_branch_name) |
| 150 | +{ |
| 151 | + zval *ref; |
| 152 | + php_git2_t *_ref; |
| 153 | + |
| 154 | + /* TODO(chobie): implement this */ |
| 155 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_name not implemented yet"); |
| 156 | + return; |
| 157 | + |
| 158 | + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 159 | + "r", &ref) == FAILURE) { |
| 160 | + return; |
| 161 | + } |
| 162 | + ZEND_FETCH_RESOURCE(_ref, php_git2_t*, &ref, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 163 | +} |
| 164 | + |
| 165 | +/* {{{ proto resource git_branch_upstream(branch) |
| 166 | +*/ |
| 167 | +PHP_FUNCTION(git_branch_upstream) |
| 168 | +{ |
| 169 | + zval *branch; |
| 170 | + php_git2_t *_branch; |
| 171 | + |
| 172 | + /* TODO(chobie): implement this */ |
| 173 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_upstream not implemented yet"); |
| 174 | + return; |
| 175 | + |
| 176 | + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 177 | + "r", &branch) == FAILURE) { |
| 178 | + return; |
| 179 | + } |
| 180 | + ZEND_FETCH_RESOURCE(_branch, php_git2_t*, &branch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 181 | +} |
| 182 | + |
| 183 | +/* {{{ proto long git_branch_set_upstream(branch, upstream_name) |
| 184 | +*/ |
| 185 | +PHP_FUNCTION(git_branch_set_upstream) |
| 186 | +{ |
| 187 | + zval *branch; |
| 188 | + php_git2_t *_branch; |
| 189 | + char *upstream_name = {0}; |
| 190 | + int upstream_name_len; |
| 191 | + |
| 192 | + /* TODO(chobie): implement this */ |
| 193 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_set_upstream not implemented yet"); |
| 194 | + return; |
| 195 | + |
| 196 | + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 197 | + "rs", &branch, &upstream_name, &upstream_name_len) == FAILURE) { |
| 198 | + return; |
| 199 | + } |
| 200 | + ZEND_FETCH_RESOURCE(_branch, php_git2_t*, &branch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 201 | +} |
| 202 | + |
| 203 | +/* {{{ proto resource git_branch_upstream_name(buffer_size, repo, canonical_branch_name) |
| 204 | +*/ |
| 205 | +PHP_FUNCTION(git_branch_upstream_name) |
| 206 | +{ |
| 207 | + zval *repo; |
| 208 | + php_git2_t *_repo; |
| 209 | + char *canonical_branch_name = {0}; |
| 210 | + int canonical_branch_name_len; |
| 211 | + |
| 212 | + /* TODO(chobie): implement this */ |
| 213 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_upstream_name not implemented yet"); |
| 214 | + return; |
| 215 | + |
| 216 | +// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 217 | +// "rs", &buffer_size, &repo, &canonical_branch_name, &canonical_branch_name_len) == FAILURE) { |
| 218 | +// return; |
| 219 | +// } |
| 220 | +// ZEND_FETCH_RESOURCE(_buffer_size, php_git2_t*, &buffer_size, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 221 | +} |
| 222 | + |
| 223 | +/* {{{ proto long git_branch_is_head(branch) |
| 224 | +*/ |
| 225 | +PHP_FUNCTION(git_branch_is_head) |
| 226 | +{ |
| 227 | + zval *branch; |
| 228 | + php_git2_t *_branch; |
| 229 | + |
| 230 | + /* TODO(chobie): implement this */ |
| 231 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_is_head not implemented yet"); |
| 232 | + return; |
| 233 | + |
| 234 | + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 235 | + "r", &branch) == FAILURE) { |
| 236 | + return; |
| 237 | + } |
| 238 | + ZEND_FETCH_RESOURCE(_branch, php_git2_t*, &branch, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 239 | +} |
| 240 | + |
| 241 | +/* {{{ proto resource git_branch_remote_name(buffer_size, repo, canonical_branch_name) |
| 242 | +*/ |
| 243 | +PHP_FUNCTION(git_branch_remote_name) |
| 244 | +{ |
| 245 | + zval *repo; |
| 246 | + php_git2_t *_repo; |
| 247 | + char *canonical_branch_name = {0}; |
| 248 | + int canonical_branch_name_len; |
| 249 | + |
| 250 | + /* TODO(chobie): implement this */ |
| 251 | + php_error_docref(NULL TSRMLS_CC, E_WARNING, "git_branch_remote_name not implemented yet"); |
| 252 | + return; |
| 253 | + |
| 254 | +// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |
| 255 | +// "rs", &buffer_size, &repo, &canonical_branch_name, &canonical_branch_name_len) == FAILURE) { |
| 256 | +// return; |
| 257 | +// } |
| 258 | +// ZEND_FETCH_RESOURCE(_buffer_size, php_git2_t*, &buffer_size, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 259 | +} |
| 260 | + |
0 commit comments