Registry Mirror
搜索
Skip to content
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Files
Expand file tree
develop
Breadcrumbs
php-git
/
graph.c
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
38 lines (32 loc) · 1.08 KB
develop
Breadcrumbs
php-git
/
graph.c
Copy path
Top
File metadata and controls
Code
Blame
38 lines (32 loc) · 1.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "php_git2.h"
#include "php_git2_priv.h"
#include "graph.h"
/* {{{ proto long git_graph_ahead_behind(resource $repo, string $local, string $upstream)
*/
PHP_FUNCTION(git_graph_ahead_behind)
{
int result = 0, local_len = 0, upstream_len = 0;
zval *repo = NULL, *array = NULL;
php_git2_t *_repo = NULL;
char *local = NULL, *upstream = NULL;
git_oid __local = {0}, __upstream = {0};
size_t ahead = 0, behind = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"rss", &ahead, &behind, &repo, &local, &local_len, &upstream, &upstream_len) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle);
if (git_oid_fromstrn(&__local, local, local_len)) {
RETURN_FALSE;
}
if (git_oid_fromstrn(&__upstream, upstream, upstream_len)) {
RETURN_FALSE;
}
result = git_graph_ahead_behind(&ahead, &behind, PHP_GIT2_V(_repo, repository), &__local, &__upstream);
MAKE_STD_ZVAL(array);
array_init(array);
add_next_index_long(array, ahead);
add_next_index_long(array, behind);
RETURN_ZVAL(array, 0, 1);
}
/* }}} */
You can’t perform that action at this time.