line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
MODULE = Git::Raw PACKAGE = Git::Raw::PathSpec |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
SV * |
4
|
|
|
|
|
|
|
new(class, ...) |
5
|
|
|
|
|
|
|
SV *class |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
PROTOTYPE: $;@ |
8
|
|
|
|
|
|
|
PREINIT: |
9
|
|
|
|
|
|
|
int i, count, rc; |
10
|
|
|
|
|
|
|
|
11
|
9
|
|
|
|
|
|
git_strarray paths = {NULL, 0}; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
PathSpec ps; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
CODE: |
16
|
9
|
100
|
|
|
|
|
if (items == 1) |
17
|
1
|
|
|
|
|
|
croak_usage("No 'paths' provided"); |
18
|
|
|
|
|
|
|
|
19
|
8
|
|
|
|
|
|
count = items - 1; |
20
|
8
|
50
|
|
|
|
|
Newxz(paths.strings, count, char *); |
21
|
17
|
100
|
|
|
|
|
for (i = 0; i < count; ++i) { |
22
|
10
|
100
|
|
|
|
|
if (!SvPOK(ST(i + 1))) { |
23
|
1
|
|
|
|
|
|
Safefree(paths.strings); |
24
|
1
|
|
|
|
|
|
croak_usage("Expected a string for 'path'"); |
25
|
|
|
|
|
|
|
} |
26
|
9
|
50
|
|
|
|
|
paths.strings[i] = SvPVbyte_nolen(ST(i + 1)); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
7
|
|
|
|
|
|
paths.count = (size_t) count; |
30
|
|
|
|
|
|
|
|
31
|
7
|
|
|
|
|
|
rc = git_pathspec_new(&ps, &paths); |
32
|
7
|
|
|
|
|
|
Safefree(paths.strings); |
33
|
7
|
|
|
|
|
|
git_check_error(rc); |
34
|
|
|
|
|
|
|
|
35
|
7
|
50
|
|
|
|
|
GIT_NEW_OBJ( |
36
|
|
|
|
|
|
|
RETVAL, SvPVbyte_nolen(class), ps |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
OUTPUT: RETVAL |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
SV * |
42
|
|
|
|
|
|
|
match(self, obj, ...) |
43
|
|
|
|
|
|
|
PathSpec self |
44
|
|
|
|
|
|
|
SV *obj |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
PROTOTYPE: $$;$ |
47
|
|
|
|
|
|
|
PREINIT: |
48
|
12
|
|
|
|
|
|
unsigned flags = 0; |
49
|
|
|
|
|
|
|
|
50
|
12
|
|
|
|
|
|
git_pathspec_match_list *list = NULL; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
CODE: |
53
|
12
|
100
|
|
|
|
|
if (items == 3) { |
54
|
6
|
|
|
|
|
|
HV *hopt, *opts = git_ensure_hv(ST(2), "options"); |
55
|
|
|
|
|
|
|
|
56
|
6
|
50
|
|
|
|
|
if ((hopt = git_hv_hash_entry(opts, "flags"))) { |
57
|
6
|
|
|
|
|
|
git_flag_opt(hopt, "ignore_case", GIT_PATHSPEC_IGNORE_CASE, &flags); |
58
|
6
|
|
|
|
|
|
git_flag_opt(hopt, "use_case", GIT_PATHSPEC_USE_CASE, &flags); |
59
|
6
|
|
|
|
|
|
git_flag_opt(hopt, "no_glob", GIT_PATHSPEC_NO_GLOB, &flags); |
60
|
6
|
|
|
|
|
|
git_flag_opt(hopt, "no_match_error", GIT_PATHSPEC_NO_MATCH_ERROR, &flags); |
61
|
6
|
|
|
|
|
|
git_flag_opt(hopt, "find_failures", GIT_PATHSPEC_FIND_FAILURES, &flags); |
62
|
6
|
|
|
|
|
|
git_flag_opt(hopt, "failures_only", GIT_PATHSPEC_FAILURES_ONLY, &flags); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
12
|
100
|
|
|
|
|
if (sv_isobject(obj)) { |
67
|
11
|
|
|
|
|
|
int rc = 0; |
68
|
|
|
|
|
|
|
|
69
|
11
|
100
|
|
|
|
|
if (sv_derived_from(obj, "Git::Raw::Repository")) { |
70
|
6
|
|
|
|
|
|
Repository repo = GIT_SV_TO_PTR(Repository, obj); |
71
|
6
|
|
|
|
|
|
rc = git_pathspec_match_workdir( |
72
|
|
|
|
|
|
|
&list, |
73
|
|
|
|
|
|
|
repo -> repository, |
74
|
|
|
|
|
|
|
flags, self); |
75
|
5
|
100
|
|
|
|
|
} else if (sv_derived_from(obj, "Git::Raw::Index")) { |
76
|
1
|
|
|
|
|
|
rc = git_pathspec_match_index( |
77
|
|
|
|
|
|
|
&list, |
78
|
1
|
|
|
|
|
|
GIT_SV_TO_PTR(Index, obj), |
79
|
|
|
|
|
|
|
flags, self); |
80
|
4
|
50
|
|
|
|
|
} else if (sv_derived_from(obj, "Git::Raw::Tree")) { |
81
|
4
|
|
|
|
|
|
rc = git_pathspec_match_tree( |
82
|
|
|
|
|
|
|
&list, |
83
|
4
|
|
|
|
|
|
GIT_SV_TO_PTR(Tree, obj), |
84
|
|
|
|
|
|
|
flags, self); |
85
|
0
|
0
|
|
|
|
|
} else if (sv_derived_from(obj, "Git::Raw::Diff")) { |
86
|
0
|
|
|
|
|
|
rc = git_pathspec_match_diff( |
87
|
|
|
|
|
|
|
&list, |
88
|
0
|
|
|
|
|
|
GIT_SV_TO_PTR(Diff, obj), |
89
|
|
|
|
|
|
|
flags, self); |
90
|
|
|
|
|
|
|
} |
91
|
11
|
|
|
|
|
|
git_check_error(rc); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
11
|
100
|
|
|
|
|
if (list == NULL) |
95
|
1
|
|
|
|
|
|
croak_usage("Expected a 'Git::Raw::Repository', 'Git::Raw::Index', " |
96
|
|
|
|
|
|
|
"'Git::Raw::Tree' or 'Git::Raw::Diff' object"); |
97
|
|
|
|
|
|
|
|
98
|
10
|
|
|
|
|
|
GIT_NEW_OBJ( |
99
|
|
|
|
|
|
|
RETVAL, "Git::Raw::PathSpec::MatchList", list |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
OUTPUT: RETVAL |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
void |
105
|
|
|
|
|
|
|
DESTROY(self) |
106
|
|
|
|
|
|
|
SV *self |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
PREINIT: |
109
|
|
|
|
|
|
|
PathSpec ps; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
CODE: |
112
|
7
|
|
|
|
|
|
ps = GIT_SV_TO_PTR(PathSpec, self); |
113
|
7
|
|
|
|
|
|
git_pathspec_free(ps); |