|
1 | 1 | #include "php_git2.h"
|
2 | 2 | #include "php_git2_priv.h"
|
3 | 3 | #include "merge.h"
|
| 4 | + |
4 | 5 | /* {{{ proto resource git_merge_base(resource $repo, string $one, string $two)
|
5 | 6 | */
|
6 | 7 | PHP_FUNCTION(git_merge_base)
|
@@ -202,24 +203,30 @@ PHP_FUNCTION(git_merge_trees)
|
202 | 203 | }
|
203 | 204 | /* }}} */
|
204 | 205 |
|
205 |
| -/* {{{ proto resource git_merge(resource $repo, long $their_heads_len, $opts) |
| 206 | +/* {{{ proto resource git_merge(resource $repo, array $their_heads, array $opts) |
206 | 207 | */
|
207 | 208 | PHP_FUNCTION(git_merge)
|
208 | 209 | {
|
209 |
| - php_git2_t *result = NULL, *_repo = NULL; |
| 210 | + php_git2_t *result = NULL, *_repo = NULL, *_their_head = NULL; |
210 | 211 | git_merge_result *out = NULL;
|
211 |
| - zval *repo = NULL, *opts = NULL; |
| 212 | + zval *repo = NULL, *opts = NULL, *theirhead = NULL; |
212 | 213 | git_merge_head *their_heads = NULL;
|
| 214 | + git_merge_head *heads[1]; |
213 | 215 | long their_heads_len = 0;
|
214 | 216 | int error = 0;
|
| 217 | + git_merge_opts options = GIT_MERGE_OPTS_INIT; |
215 | 218 |
|
216 | 219 | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
|
217 |
| - "rl<git_merge_opts>", &repo, &their_heads_len, &opts) == FAILURE) { |
| 220 | + "rza", &repo, &theirhead, &opts) == FAILURE) { |
218 | 221 | return;
|
219 | 222 | }
|
220 |
| - |
| 223 | + |
221 | 224 | ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle);
|
222 |
| - error = git_merge(&out, PHP_GIT2_V(_repo, repository), &their_heads, their_heads_len, opts); |
| 225 | + ZEND_FETCH_RESOURCE(_their_head, php_git2_t*, &theirhead, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle); |
| 226 | + heads[0] = PHP_GIT2_V(_their_head, merge_head); |
| 227 | + options.merge_flags = GIT_MERGE_NO_FASTFORWARD; |
| 228 | + |
| 229 | + error = git_merge(&out, PHP_GIT2_V(_repo, repository), heads, 1, &options); |
223 | 230 | if (php_git2_check_error(error, "git_merge" TSRMLS_CC)) {
|
224 | 231 | RETURN_FALSE;
|
225 | 232 | }
|
@@ -289,7 +296,7 @@ PHP_FUNCTION(git_merge_result_fastforward_oid)
|
289 | 296 | RETURN_FALSE;
|
290 | 297 | }
|
291 | 298 | git_oid_fmt(buf, &out);
|
292 |
| - RETURN_SRING(buf, 1); |
| 299 | + RETURN_STRING(buf, 1); |
293 | 300 | }
|
294 | 301 | /* }}} */
|
295 | 302 |
|
|
0 commit comments