-
Notifications
You must be signed in to change notification settings - Fork 78
/
ignore.c
64 lines (54 loc) · 1.65 KB
/
ignore.c
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "php_git2.h"
#include "php_git2_priv.h"
#include "ignore.h"
/* {{{ proto long git_ignore_add_rule(resource $repo, string $rules)
*/
PHP_FUNCTION(git_ignore_add_rule)
{
int result = 0, rules_len = 0;
zval *repo = NULL;
php_git2_t *_repo = NULL;
char *rules = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"rs", &repo, &rules, &rules_len) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle);
result = git_ignore_add_rule(PHP_GIT2_V(_repo, repository), rules);
RETURN_LONG(result);
}
/* }}} */
/* {{{ proto long git_ignore_clear_internal_rules(resource $repo)
*/
PHP_FUNCTION(git_ignore_clear_internal_rules)
{
int result = 0;
zval *repo = NULL;
php_git2_t *_repo = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"r", &repo) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle);
result = git_ignore_clear_internal_rules(PHP_GIT2_V(_repo, repository));
RETURN_LONG(result);
}
/* }}} */
/* {{{ proto long git_ignore_path_is_ignored(long $ignored, resource $repo, string $path)
*/
PHP_FUNCTION(git_ignore_path_is_ignored)
{
int result = 0, path_len = 0;
long ignored = 0;
zval *repo = NULL;
php_git2_t *_repo = NULL;
char *path = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"lrs", &ignored, &repo, &path, &path_len) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(_repo, php_git2_t*, &repo, -1, PHP_GIT2_RESOURCE_NAME, git2_resource_handle);
result = git_ignore_path_is_ignored(ignored, PHP_GIT2_V(_repo, repository), path);
RETURN_BOOL(result);
}
/* }}} */