line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
MODULE = Git::Raw PACKAGE = Git::Raw::Tree::Builder |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
SV * |
4
|
|
|
|
|
|
|
new(class, repo, ...) |
5
|
|
|
|
|
|
|
const char *class |
6
|
|
|
|
|
|
|
SV *repo |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
PREINIT: |
9
|
|
|
|
|
|
|
int rc; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Repository r; |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
|
|
|
Tree source = NULL; |
14
|
|
|
|
|
|
|
Tree_Builder builder; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
CODE: |
17
|
2
|
100
|
|
|
|
|
if (items > 2) |
18
|
1
|
|
|
|
|
|
source = GIT_SV_TO_PTR(Tree, ST(2)); |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
|
r = GIT_SV_TO_PTR(Repository, repo); |
21
|
2
|
|
|
|
|
|
rc = git_treebuilder_new(&builder, r -> repository, |
22
|
|
|
|
|
|
|
source); |
23
|
2
|
|
|
|
|
|
git_check_error(rc); |
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC(RETVAL, class, builder, SvRV(repo)); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
OUTPUT: RETVAL |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
void |
30
|
|
|
|
|
|
|
clear(self) |
31
|
|
|
|
|
|
|
Tree_Builder self |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
CODE: |
34
|
1
|
|
|
|
|
|
git_treebuilder_clear(self); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
unsigned int |
37
|
|
|
|
|
|
|
entry_count(self) |
38
|
|
|
|
|
|
|
Tree_Builder self |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
CODE: |
41
|
6
|
|
|
|
|
|
RETVAL = git_treebuilder_entrycount(self); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
OUTPUT: RETVAL |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
SV * |
46
|
|
|
|
|
|
|
get(self, filename) |
47
|
|
|
|
|
|
|
SV *self |
48
|
|
|
|
|
|
|
const char *filename |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
PREINIT: |
51
|
|
|
|
|
|
|
int rc; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
CODE: |
54
|
4
|
|
|
|
|
|
const Tree_Entry tmp_entry = (const Tree_Entry) |
55
|
|
|
|
|
|
|
git_treebuilder_get( |
56
|
4
|
|
|
|
|
|
GIT_SV_TO_PTR(Tree::Builder, self), filename |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
4
|
100
|
|
|
|
|
if (tmp_entry) { |
60
|
|
|
|
|
|
|
Tree_Entry entry; |
61
|
|
|
|
|
|
|
|
62
|
3
|
|
|
|
|
|
rc = git_tree_entry_dup(&entry, tmp_entry); |
63
|
3
|
|
|
|
|
|
git_check_error(rc); |
64
|
|
|
|
|
|
|
|
65
|
3
|
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
66
|
|
|
|
|
|
|
RETVAL, "Git::Raw::Tree::Entry", |
67
|
|
|
|
|
|
|
entry, GIT_SV_TO_MAGIC(self) |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else |
71
|
1
|
|
|
|
|
|
RETVAL = &PL_sv_undef; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
OUTPUT: RETVAL |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
void |
76
|
|
|
|
|
|
|
insert(self, filename, object, mode) |
77
|
|
|
|
|
|
|
SV *self |
78
|
|
|
|
|
|
|
const char *filename |
79
|
|
|
|
|
|
|
SV *object |
80
|
|
|
|
|
|
|
int mode |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
PREINIT: |
83
|
|
|
|
|
|
|
int rc; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
const git_oid *oid; |
86
|
|
|
|
|
|
|
const Tree_Entry tmp_entry; |
87
|
|
|
|
|
|
|
Tree_Entry entry; |
88
|
|
|
|
|
|
|
|
89
|
6
|
50
|
|
|
|
|
int is_returning = GIMME_V != G_VOID; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
PPCODE: |
92
|
6
|
50
|
|
|
|
|
if (sv_isobject(object) && sv_derived_from(object, "Git::Raw::Blob")) |
|
|
100
|
|
|
|
|
|
93
|
5
|
|
|
|
|
|
oid = git_blob_id(GIT_SV_TO_PTR(Blob, object)); |
94
|
|
|
|
|
|
|
else |
95
|
1
|
|
|
|
|
|
oid = git_tree_id(GIT_SV_TO_PTR(Tree, object)); |
96
|
|
|
|
|
|
|
|
97
|
6
|
100
|
|
|
|
|
rc = git_treebuilder_insert( |
98
|
|
|
|
|
|
|
is_returning ? (const git_tree_entry **) &tmp_entry : NULL, |
99
|
6
|
|
|
|
|
|
GIT_SV_TO_PTR(Tree::Builder, self), |
100
|
|
|
|
|
|
|
filename, oid, mode |
101
|
|
|
|
|
|
|
); |
102
|
6
|
|
|
|
|
|
git_check_error(rc); |
103
|
|
|
|
|
|
|
|
104
|
4
|
100
|
|
|
|
|
if (is_returning) { |
105
|
1
|
|
|
|
|
|
rc = git_tree_entry_dup(&entry, tmp_entry); |
106
|
1
|
|
|
|
|
|
git_check_error(rc); |
107
|
|
|
|
|
|
|
|
108
|
1
|
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
109
|
|
|
|
|
|
|
ST(0), "Git::Raw::Tree::Entry", entry, |
110
|
|
|
|
|
|
|
GIT_SV_TO_MAGIC(self) |
111
|
|
|
|
|
|
|
); |
112
|
|
|
|
|
|
|
|
113
|
1
|
|
|
|
|
|
sv_2mortal(ST(0)); |
114
|
1
|
|
|
|
|
|
XSRETURN(1); |
115
|
4
|
|
|
|
|
|
} else XSRETURN_EMPTY; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
void |
118
|
|
|
|
|
|
|
remove(self, filename) |
119
|
|
|
|
|
|
|
Tree_Builder self |
120
|
|
|
|
|
|
|
const char *filename |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
PREINIT: |
123
|
|
|
|
|
|
|
int rc; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
CODE: |
126
|
2
|
|
|
|
|
|
rc = git_treebuilder_remove(self, filename); |
127
|
2
|
|
|
|
|
|
git_check_error(rc); |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
void |
130
|
|
|
|
|
|
|
write(self) |
131
|
|
|
|
|
|
|
SV *self |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
PREINIT: |
134
|
|
|
|
|
|
|
int rc; |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Tree tree; |
137
|
|
|
|
|
|
|
git_oid oid; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
SV *repo; |
140
|
|
|
|
|
|
|
Repository repo_ptr; |
141
|
|
|
|
|
|
|
|
142
|
3
|
50
|
|
|
|
|
int is_returning = GIMME_V != G_VOID; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
PPCODE: |
145
|
3
|
|
|
|
|
|
repo = GIT_SV_TO_MAGIC(self); |
146
|
3
|
50
|
|
|
|
|
repo_ptr = INT2PTR(Repository, SvIV((SV *) repo)); |
147
|
|
|
|
|
|
|
|
148
|
3
|
|
|
|
|
|
rc = git_treebuilder_write( |
149
|
3
|
|
|
|
|
|
&oid, GIT_SV_TO_PTR(Tree::Builder, self) |
150
|
|
|
|
|
|
|
); |
151
|
3
|
|
|
|
|
|
git_check_error(rc); |
152
|
|
|
|
|
|
|
|
153
|
3
|
50
|
|
|
|
|
if (is_returning) { |
154
|
3
|
|
|
|
|
|
rc = git_tree_lookup(&tree, repo_ptr -> repository, &oid); |
155
|
3
|
|
|
|
|
|
git_check_error(rc); |
156
|
|
|
|
|
|
|
|
157
|
3
|
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
158
|
|
|
|
|
|
|
ST(0), "Git::Raw::Tree", tree, repo |
159
|
|
|
|
|
|
|
); |
160
|
3
|
|
|
|
|
|
sv_2mortal(ST(0)); |
161
|
|
|
|
|
|
|
|
162
|
3
|
|
|
|
|
|
XSRETURN(1); |
163
|
3
|
|
|
|
|
|
} else XSRETURN_EMPTY; |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
void |
166
|
|
|
|
|
|
|
DESTROY(self) |
167
|
|
|
|
|
|
|
SV *self |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
CODE: |
170
|
2
|
|
|
|
|
|
git_treebuilder_free(GIT_SV_TO_PTR(Tree::Builder, self)); |
171
|
2
|
|
|
|
|
|
SvREFCNT_dec(GIT_SV_TO_MAGIC(self)); |