| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
MODULE = Git::Raw PACKAGE = Git::Raw::Index |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
SV * |
|
4
|
|
|
|
|
|
|
new(class) |
|
5
|
|
|
|
|
|
|
SV *class |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
PREINIT: |
|
8
|
|
|
|
|
|
|
int rc; |
|
9
|
|
|
|
|
|
|
Index index; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
CODE: |
|
12
|
1
|
|
|
|
|
|
rc = git_index_new(&index); |
|
13
|
1
|
|
|
|
|
|
git_check_error(rc); |
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
|
GIT_NEW_OBJ( |
|
16
|
|
|
|
|
|
|
RETVAL, "Git::Raw::Index", index |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
void |
|
23
|
|
|
|
|
|
|
add(self, entry) |
|
24
|
|
|
|
|
|
|
Index self |
|
25
|
|
|
|
|
|
|
SV *entry |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
PREINIT: |
|
28
|
50
|
|
|
|
|
|
int rc = 0; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
CODE: |
|
31
|
50
|
100
|
|
|
|
|
if (SvPOK(entry)) |
|
32
|
48
|
50
|
|
|
|
|
rc = git_index_add_bypath(self, SvPVbyte_nolen(entry)); |
|
33
|
|
|
|
|
|
|
else { |
|
34
|
2
|
|
|
|
|
|
Index_Entry e = GIT_SV_TO_PTR(Index::Entry, entry); |
|
35
|
1
|
|
|
|
|
|
rc = git_index_add(self, e); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
49
|
|
|
|
|
|
git_check_error(rc); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
SV * |
|
41
|
|
|
|
|
|
|
add_frombuffer(self, path, buffer, ...) |
|
42
|
|
|
|
|
|
|
SV *self |
|
43
|
|
|
|
|
|
|
SV *path |
|
44
|
|
|
|
|
|
|
SV *buffer |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
PREINIT: |
|
47
|
|
|
|
|
|
|
int rc; |
|
48
|
|
|
|
|
|
|
Index index; |
|
49
|
|
|
|
|
|
|
git_index_entry *entry; |
|
50
|
|
|
|
|
|
|
git_index_entry ientry; |
|
51
|
|
|
|
|
|
|
const char *b; |
|
52
|
|
|
|
|
|
|
STRLEN len; |
|
53
|
11
|
|
|
|
|
|
int mode = GIT_FILEMODE_BLOB; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
CODE: |
|
56
|
11
|
100
|
|
|
|
|
if (items == 4) |
|
57
|
6
|
|
|
|
|
|
mode = (int) git_ensure_iv(ST(3), "mode"); |
|
58
|
|
|
|
|
|
|
|
|
59
|
10
|
|
|
|
|
|
index = GIT_SV_TO_PTR(Index, self); |
|
60
|
|
|
|
|
|
|
|
|
61
|
10
|
100
|
|
|
|
|
if (!SvOK(buffer)) |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
|
croak_usage("Buffer not provided"); |
|
63
|
|
|
|
|
|
|
|
|
64
|
9
|
100
|
|
|
|
|
if (SvROK(buffer)) |
|
65
|
1
|
|
|
|
|
|
buffer = SvRV(buffer); |
|
66
|
|
|
|
|
|
|
|
|
67
|
9
|
|
|
|
|
|
memset(&ientry, 0x0, sizeof(git_index_entry)); |
|
68
|
9
|
|
|
|
|
|
ientry.mode = mode; |
|
69
|
9
|
|
|
|
|
|
ientry.path = git_ensure_pv(path, "path"); |
|
70
|
|
|
|
|
|
|
|
|
71
|
9
|
|
|
|
|
|
b = git_ensure_pv_with_len(buffer, "buffer", &len); |
|
72
|
9
|
|
|
|
|
|
rc = git_index_add_frombuffer(index, &ientry, |
|
73
|
|
|
|
|
|
|
b, (size_t) len); |
|
74
|
9
|
|
|
|
|
|
git_check_error(rc); |
|
75
|
|
|
|
|
|
|
|
|
76
|
7
|
|
|
|
|
|
RETVAL = git_index_entry_to_sv( |
|
77
|
|
|
|
|
|
|
git_index_get_bypath(index, ientry.path, 0), |
|
78
|
7
|
|
|
|
|
|
NULL, GIT_SV_TO_MAGIC(self) |
|
79
|
|
|
|
|
|
|
); |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
void |
|
84
|
|
|
|
|
|
|
add_all(self, opts) |
|
85
|
|
|
|
|
|
|
Index self |
|
86
|
|
|
|
|
|
|
HV *opts |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
PREINIT: |
|
89
|
|
|
|
|
|
|
int rc; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
SV *callback; |
|
92
|
|
|
|
|
|
|
AV *lopt; |
|
93
|
|
|
|
|
|
|
HV *hopt; |
|
94
|
4
|
|
|
|
|
|
git_strarray paths = {0, 0}; |
|
95
|
|
|
|
|
|
|
|
|
96
|
4
|
|
|
|
|
|
unsigned int flags = GIT_INDEX_ADD_DEFAULT; |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
CODE: |
|
99
|
4
|
50
|
|
|
|
|
if ((lopt = git_hv_list_entry(opts, "paths"))) |
|
100
|
4
|
|
|
|
|
|
git_list_to_paths(lopt, &paths); |
|
101
|
|
|
|
|
|
|
|
|
102
|
4
|
100
|
|
|
|
|
if ((hopt = git_hv_hash_entry(opts, "flags"))) { |
|
103
|
3
|
|
|
|
|
|
git_flag_opt(hopt, "force", GIT_INDEX_ADD_FORCE, &flags); |
|
104
|
3
|
|
|
|
|
|
git_flag_opt(hopt, "disable_pathspec_match", GIT_INDEX_ADD_DISABLE_PATHSPEC_MATCH, &flags); |
|
105
|
3
|
|
|
|
|
|
git_flag_opt(hopt, "check_pathspec", GIT_INDEX_ADD_CHECK_PATHSPEC, &flags); |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
4
|
|
|
|
|
|
callback = get_callback_option(opts, "notification"); |
|
109
|
|
|
|
|
|
|
|
|
110
|
4
|
|
|
|
|
|
rc = git_index_add_all( |
|
111
|
|
|
|
|
|
|
self, |
|
112
|
|
|
|
|
|
|
&paths, |
|
113
|
|
|
|
|
|
|
flags, |
|
114
|
|
|
|
|
|
|
git_index_matched_path_cbb, |
|
115
|
|
|
|
|
|
|
callback); |
|
116
|
4
|
|
|
|
|
|
Safefree(paths.strings); |
|
117
|
4
|
|
|
|
|
|
git_check_error(rc); |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
void |
|
120
|
|
|
|
|
|
|
clear(self) |
|
121
|
|
|
|
|
|
|
Index self |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
CODE: |
|
124
|
2
|
|
|
|
|
|
git_index_clear(self); |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
SV * |
|
127
|
|
|
|
|
|
|
checksum(self) |
|
128
|
|
|
|
|
|
|
Index self |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
CODE: |
|
131
|
1
|
|
|
|
|
|
RETVAL = git_oid_to_sv(git_index_checksum(self)); |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
void |
|
136
|
|
|
|
|
|
|
read(self, ...) |
|
137
|
|
|
|
|
|
|
Index self |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
PROTOTYPE: $;$ |
|
140
|
|
|
|
|
|
|
PREINIT: |
|
141
|
2
|
|
|
|
|
|
int rc, force = 0; |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
CODE: |
|
144
|
2
|
100
|
|
|
|
|
if (items == 2) |
|
145
|
1
|
|
|
|
|
|
force = git_ensure_iv(ST(1), "force"); |
|
146
|
|
|
|
|
|
|
|
|
147
|
2
|
|
|
|
|
|
rc = git_index_read(self, force); |
|
148
|
2
|
|
|
|
|
|
git_check_error(rc); |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
void |
|
151
|
|
|
|
|
|
|
write(self) |
|
152
|
|
|
|
|
|
|
Index self |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
PREINIT: |
|
155
|
|
|
|
|
|
|
int rc; |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
CODE: |
|
158
|
41
|
|
|
|
|
|
rc = git_index_write(self); |
|
159
|
41
|
|
|
|
|
|
git_check_error(rc); |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
void |
|
162
|
|
|
|
|
|
|
read_tree(self, tree) |
|
163
|
|
|
|
|
|
|
Index self |
|
164
|
|
|
|
|
|
|
Tree tree |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
PREINIT: |
|
167
|
|
|
|
|
|
|
int rc; |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
CODE: |
|
170
|
3
|
|
|
|
|
|
rc = git_index_read_tree(self, tree); |
|
171
|
3
|
|
|
|
|
|
git_check_error(rc); |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
SV * |
|
174
|
|
|
|
|
|
|
write_tree(self, ...) |
|
175
|
|
|
|
|
|
|
SV *self |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
PROTOTYPE: $;$ |
|
178
|
|
|
|
|
|
|
PREINIT: |
|
179
|
|
|
|
|
|
|
int rc; |
|
180
|
|
|
|
|
|
|
git_oid oid; |
|
181
|
|
|
|
|
|
|
Index index; |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
SV *repo; |
|
184
|
|
|
|
|
|
|
Repository repo_ptr; |
|
185
|
|
|
|
|
|
|
Tree tree; |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
CODE: |
|
188
|
40
|
|
|
|
|
|
index = GIT_SV_TO_PTR(Index, self); |
|
189
|
|
|
|
|
|
|
|
|
190
|
40
|
100
|
|
|
|
|
if (items == 2) { |
|
191
|
1
|
|
|
|
|
|
repo = SvRV(ST(1)); |
|
192
|
1
|
50
|
|
|
|
|
repo_ptr = INT2PTR(Repository, SvIV((SV *) repo)); |
|
193
|
|
|
|
|
|
|
|
|
194
|
1
|
|
|
|
|
|
rc = git_index_write_tree_to( |
|
195
|
|
|
|
|
|
|
&oid, index, repo_ptr -> repository |
|
196
|
|
|
|
|
|
|
); |
|
197
|
|
|
|
|
|
|
} else { |
|
198
|
39
|
|
|
|
|
|
repo = GIT_SV_TO_MAGIC(self); |
|
199
|
39
|
100
|
|
|
|
|
if (repo == NULL) |
|
200
|
1
|
|
|
|
|
|
croak_usage("No repository associated with this index"); |
|
201
|
|
|
|
|
|
|
|
|
202
|
38
|
50
|
|
|
|
|
repo_ptr = INT2PTR(Repository, SvIV((SV *) repo)); |
|
203
|
|
|
|
|
|
|
|
|
204
|
38
|
|
|
|
|
|
rc = git_index_write_tree(&oid, index); |
|
205
|
|
|
|
|
|
|
} |
|
206
|
39
|
|
|
|
|
|
git_check_error(rc); |
|
207
|
|
|
|
|
|
|
|
|
208
|
39
|
|
|
|
|
|
rc = git_tree_lookup(&tree, repo_ptr -> repository, |
|
209
|
|
|
|
|
|
|
&oid |
|
210
|
|
|
|
|
|
|
); |
|
211
|
39
|
|
|
|
|
|
git_check_error(rc); |
|
212
|
|
|
|
|
|
|
|
|
213
|
39
|
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
|
214
|
|
|
|
|
|
|
RETVAL, "Git::Raw::Tree", |
|
215
|
|
|
|
|
|
|
tree, repo |
|
216
|
|
|
|
|
|
|
); |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
SV * |
|
221
|
|
|
|
|
|
|
find(self, path) |
|
222
|
|
|
|
|
|
|
SV *self |
|
223
|
|
|
|
|
|
|
SV *path |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
PREINIT: |
|
226
|
|
|
|
|
|
|
int rc; |
|
227
|
|
|
|
|
|
|
size_t pos; |
|
228
|
|
|
|
|
|
|
Index index; |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
CODE: |
|
231
|
2
|
|
|
|
|
|
RETVAL = &PL_sv_undef; |
|
232
|
|
|
|
|
|
|
|
|
233
|
2
|
|
|
|
|
|
index = GIT_SV_TO_PTR(Index, self); |
|
234
|
|
|
|
|
|
|
|
|
235
|
2
|
|
|
|
|
|
rc = git_index_find(&pos, index, git_ensure_pv(path, "path")); |
|
236
|
2
|
100
|
|
|
|
|
if (rc != GIT_ENOTFOUND) { |
|
237
|
1
|
|
|
|
|
|
git_check_error(rc); |
|
238
|
|
|
|
|
|
|
|
|
239
|
1
|
|
|
|
|
|
RETVAL = git_index_entry_to_sv( |
|
240
|
|
|
|
|
|
|
git_index_get_byindex(index, pos), NULL, |
|
241
|
1
|
|
|
|
|
|
GIT_SV_TO_MAGIC(self) |
|
242
|
|
|
|
|
|
|
); |
|
243
|
|
|
|
|
|
|
} |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
SV * |
|
248
|
|
|
|
|
|
|
merge(self, ancestor, theirs, ours, ...) |
|
249
|
|
|
|
|
|
|
SV *self |
|
250
|
|
|
|
|
|
|
Index_Entry ancestor |
|
251
|
|
|
|
|
|
|
Index_Entry theirs |
|
252
|
|
|
|
|
|
|
Index_Entry ours |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
PROTOTYPE: $$$$;$ |
|
255
|
|
|
|
|
|
|
PREINIT: |
|
256
|
|
|
|
|
|
|
int rc; |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
SV *repo; |
|
259
|
|
|
|
|
|
|
Repository repo_ptr; |
|
260
|
|
|
|
|
|
|
|
|
261
|
3
|
|
|
|
|
|
git_merge_file_options options = GIT_MERGE_FILE_OPTIONS_INIT; |
|
262
|
|
|
|
|
|
|
git_merge_file_result result; |
|
263
|
3
|
|
|
|
|
|
Merge_File_Result out = NULL; |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
CODE: |
|
266
|
3
|
50
|
|
|
|
|
if (items == 5 && SvOK(ST(4))) { |
|
|
|
50
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
267
|
3
|
|
|
|
|
|
HV *opts = git_ensure_hv(ST(4), "merge_opts"); |
|
268
|
3
|
|
|
|
|
|
git_hv_to_merge_file_opts(opts, &options); |
|
269
|
|
|
|
|
|
|
} |
|
270
|
|
|
|
|
|
|
|
|
271
|
2
|
|
|
|
|
|
repo = GIT_SV_TO_MAGIC(self); |
|
272
|
2
|
50
|
|
|
|
|
repo_ptr = INT2PTR(Repository, SvIV((SV *) repo)); |
|
273
|
|
|
|
|
|
|
|
|
274
|
2
|
|
|
|
|
|
rc = git_merge_file_from_index(&result, repo_ptr -> repository, |
|
275
|
|
|
|
|
|
|
ancestor, |
|
276
|
|
|
|
|
|
|
ours, |
|
277
|
|
|
|
|
|
|
theirs, |
|
278
|
|
|
|
|
|
|
&options); |
|
279
|
2
|
|
|
|
|
|
git_check_error(rc); |
|
280
|
|
|
|
|
|
|
|
|
281
|
2
|
|
|
|
|
|
Newxz(out, 1, git_merge_file_result); |
|
282
|
2
|
|
|
|
|
|
StructCopy(&result, out, git_merge_file_result); |
|
283
|
|
|
|
|
|
|
|
|
284
|
2
|
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
|
285
|
|
|
|
|
|
|
RETVAL, "Git::Raw::Merge::File::Result", |
|
286
|
|
|
|
|
|
|
out, repo |
|
287
|
|
|
|
|
|
|
); |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
void |
|
292
|
|
|
|
|
|
|
remove(self, path) |
|
293
|
|
|
|
|
|
|
Index self |
|
294
|
|
|
|
|
|
|
SV *path |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
PREINIT: |
|
297
|
|
|
|
|
|
|
int rc; |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
CODE: |
|
300
|
5
|
|
|
|
|
|
rc = git_index_remove_bypath(self, git_ensure_pv(path, "path")); |
|
301
|
5
|
|
|
|
|
|
git_check_error(rc); |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
void |
|
304
|
|
|
|
|
|
|
remove_all(self, opts) |
|
305
|
|
|
|
|
|
|
Index self |
|
306
|
|
|
|
|
|
|
HV *opts |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
PREINIT: |
|
309
|
|
|
|
|
|
|
int rc; |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
SV *callback; |
|
312
|
|
|
|
|
|
|
AV *lopt; |
|
313
|
1
|
|
|
|
|
|
git_strarray paths = {0, 0}; |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
CODE: |
|
316
|
1
|
50
|
|
|
|
|
if ((lopt = git_hv_list_entry(opts, "paths"))) |
|
317
|
1
|
|
|
|
|
|
git_list_to_paths(lopt, &paths); |
|
318
|
|
|
|
|
|
|
|
|
319
|
1
|
|
|
|
|
|
callback = get_callback_option(opts, "notification"); |
|
320
|
|
|
|
|
|
|
|
|
321
|
1
|
|
|
|
|
|
rc = git_index_remove_all( |
|
322
|
|
|
|
|
|
|
self, |
|
323
|
|
|
|
|
|
|
&paths, |
|
324
|
|
|
|
|
|
|
git_index_matched_path_cbb, |
|
325
|
|
|
|
|
|
|
callback); |
|
326
|
1
|
|
|
|
|
|
Safefree(paths.strings); |
|
327
|
1
|
|
|
|
|
|
git_check_error(rc); |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
SV * |
|
330
|
|
|
|
|
|
|
path(self) |
|
331
|
|
|
|
|
|
|
Index self |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
PREINIT: |
|
334
|
3
|
|
|
|
|
|
const char *path = NULL; |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
CODE: |
|
337
|
3
|
100
|
|
|
|
|
if ((path = git_index_path(self)) == NULL) |
|
338
|
2
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
339
|
|
|
|
|
|
|
|
|
340
|
1
|
|
|
|
|
|
RETVAL = newSVpv(path, 0); |
|
341
|
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
343
|
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
SV * |
|
345
|
|
|
|
|
|
|
owner(self) |
|
346
|
|
|
|
|
|
|
SV *self |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
PREINIT: |
|
349
|
|
|
|
|
|
|
SV *repo; |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
CODE: |
|
352
|
3
|
|
|
|
|
|
repo = GIT_SV_TO_MAGIC(self); |
|
353
|
3
|
100
|
|
|
|
|
if (repo == NULL) |
|
354
|
1
|
|
|
|
|
|
RETVAL = &PL_sv_undef; |
|
355
|
|
|
|
|
|
|
else |
|
356
|
2
|
|
|
|
|
|
RETVAL = newRV_inc(repo); |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
void |
|
361
|
|
|
|
|
|
|
checkout(self, ...) |
|
362
|
|
|
|
|
|
|
SV *self |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
PROTOTYPE: $;$ |
|
365
|
|
|
|
|
|
|
PREINIT: |
|
366
|
|
|
|
|
|
|
int rc; |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
SV *repo; |
|
369
|
|
|
|
|
|
|
Repository repo_ptr; |
|
370
|
|
|
|
|
|
|
|
|
371
|
1
|
|
|
|
|
|
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
CODE: |
|
374
|
1
|
|
|
|
|
|
repo = GIT_SV_TO_MAGIC(self); |
|
375
|
1
|
50
|
|
|
|
|
repo_ptr = INT2PTR(Repository, SvIV((SV *) repo)); |
|
376
|
|
|
|
|
|
|
|
|
377
|
1
|
50
|
|
|
|
|
if (items == 2) { |
|
378
|
1
|
|
|
|
|
|
git_hv_to_checkout_opts((HV *) SvRV(ST(1)), &checkout_opts); |
|
379
|
|
|
|
|
|
|
} |
|
380
|
|
|
|
|
|
|
|
|
381
|
1
|
|
|
|
|
|
rc = git_checkout_index( |
|
382
|
|
|
|
|
|
|
repo_ptr -> repository, |
|
383
|
1
|
|
|
|
|
|
GIT_SV_TO_PTR(Index, self), |
|
384
|
|
|
|
|
|
|
&checkout_opts |
|
385
|
|
|
|
|
|
|
); |
|
386
|
1
|
|
|
|
|
|
Safefree(checkout_opts.paths.strings); |
|
387
|
1
|
|
|
|
|
|
git_check_error(rc); |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
SV * |
|
390
|
|
|
|
|
|
|
entry_count(self) |
|
391
|
|
|
|
|
|
|
Index self |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
PREINIT: |
|
394
|
|
|
|
|
|
|
size_t count; |
|
395
|
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
CODE: |
|
397
|
11
|
|
|
|
|
|
count = git_index_entrycount (self); |
|
398
|
11
|
|
|
|
|
|
RETVAL = newSViv ((int) count); |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
void |
|
403
|
|
|
|
|
|
|
entries(self) |
|
404
|
|
|
|
|
|
|
SV *self |
|
405
|
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
PREINIT: |
|
407
|
|
|
|
|
|
|
size_t i, count; |
|
408
|
|
|
|
|
|
|
|
|
409
|
3
|
|
|
|
|
|
Index index_ptr = NULL; |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
PPCODE: |
|
412
|
3
|
|
|
|
|
|
index_ptr = GIT_SV_TO_PTR(Index, self); |
|
413
|
3
|
|
|
|
|
|
count = git_index_entrycount(index_ptr); |
|
414
|
|
|
|
|
|
|
|
|
415
|
3
|
100
|
|
|
|
|
if (count > 0) { |
|
416
|
2
|
|
|
|
|
|
SV *repo = GIT_SV_TO_MAGIC(self); |
|
417
|
|
|
|
|
|
|
|
|
418
|
6
|
100
|
|
|
|
|
for (i = 0; i < count; ++i) { |
|
419
|
4
|
|
|
|
|
|
SV *entry = git_index_entry_to_sv( |
|
420
|
|
|
|
|
|
|
git_index_get_byindex(index_ptr, i), NULL, repo); |
|
421
|
4
|
50
|
|
|
|
|
mXPUSHs(entry); |
|
422
|
|
|
|
|
|
|
} |
|
423
|
|
|
|
|
|
|
} |
|
424
|
|
|
|
|
|
|
|
|
425
|
3
|
|
|
|
|
|
XSRETURN(count); |
|
426
|
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
void |
|
428
|
|
|
|
|
|
|
add_conflict(self, ancestor, theirs, ours) |
|
429
|
|
|
|
|
|
|
Index self |
|
430
|
|
|
|
|
|
|
Index_Entry ancestor |
|
431
|
|
|
|
|
|
|
Index_Entry theirs |
|
432
|
|
|
|
|
|
|
Index_Entry ours |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
PREINIT: |
|
435
|
|
|
|
|
|
|
int rc; |
|
436
|
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
CODE: |
|
438
|
1
|
|
|
|
|
|
rc = git_index_conflict_add(self, |
|
439
|
|
|
|
|
|
|
ancestor, ours, theirs |
|
440
|
|
|
|
|
|
|
); |
|
441
|
1
|
|
|
|
|
|
git_check_error(rc); |
|
442
|
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
SV * |
|
444
|
|
|
|
|
|
|
get_conflict(self, path) |
|
445
|
|
|
|
|
|
|
SV *self |
|
446
|
|
|
|
|
|
|
SV *path |
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
PREINIT: |
|
449
|
|
|
|
|
|
|
int rc; |
|
450
|
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
Index index; |
|
452
|
|
|
|
|
|
|
const git_index_entry *ancestor, *ours, *theirs; |
|
453
|
1
|
|
|
|
|
|
Index_Conflict conflict = NULL; |
|
454
|
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
CODE: |
|
456
|
1
|
|
|
|
|
|
index = GIT_SV_TO_PTR(Index, self); |
|
457
|
|
|
|
|
|
|
|
|
458
|
1
|
|
|
|
|
|
rc = git_index_conflict_get( |
|
459
|
|
|
|
|
|
|
&ancestor, &ours, &theirs, |
|
460
|
|
|
|
|
|
|
index, git_ensure_pv(path, "path") |
|
461
|
|
|
|
|
|
|
); |
|
462
|
|
|
|
|
|
|
|
|
463
|
1
|
|
|
|
|
|
RETVAL = &PL_sv_undef; |
|
464
|
1
|
50
|
|
|
|
|
if (rc != GIT_ENOTFOUND) { |
|
465
|
1
|
|
|
|
|
|
git_check_error(rc); |
|
466
|
|
|
|
|
|
|
|
|
467
|
1
|
|
|
|
|
|
Newxz(conflict, 1, git_raw_index_conflict); |
|
468
|
|
|
|
|
|
|
|
|
469
|
1
|
|
|
|
|
|
conflict -> ancestor = git_index_entry_dup(ancestor, NULL); |
|
470
|
1
|
|
|
|
|
|
conflict -> ours = git_index_entry_dup(ours, NULL); |
|
471
|
1
|
|
|
|
|
|
conflict -> theirs = git_index_entry_dup(theirs, NULL); |
|
472
|
|
|
|
|
|
|
|
|
473
|
1
|
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
|
474
|
|
|
|
|
|
|
RETVAL, "Git::Raw::Index::Conflict", |
|
475
|
|
|
|
|
|
|
conflict, GIT_SV_TO_MAGIC(self) |
|
476
|
|
|
|
|
|
|
); |
|
477
|
|
|
|
|
|
|
} |
|
478
|
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
480
|
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
void |
|
482
|
|
|
|
|
|
|
remove_conflict(self, path) |
|
483
|
|
|
|
|
|
|
Index self |
|
484
|
|
|
|
|
|
|
SV *path |
|
485
|
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
PREINIT: |
|
487
|
|
|
|
|
|
|
int rc; |
|
488
|
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
CODE: |
|
490
|
2
|
|
|
|
|
|
rc = git_index_conflict_remove(self, |
|
491
|
|
|
|
|
|
|
git_ensure_pv(path, "path") |
|
492
|
|
|
|
|
|
|
); |
|
493
|
2
|
|
|
|
|
|
git_check_error(rc); |
|
494
|
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
void |
|
496
|
|
|
|
|
|
|
conflict_cleanup(self) |
|
497
|
|
|
|
|
|
|
Index self |
|
498
|
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
CODE: |
|
500
|
1
|
|
|
|
|
|
git_index_conflict_cleanup(self); |
|
501
|
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
SV * |
|
503
|
|
|
|
|
|
|
has_conflicts(self) |
|
504
|
|
|
|
|
|
|
Index self |
|
505
|
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
CODE: |
|
507
|
19
|
|
|
|
|
|
RETVAL = newSViv(git_index_has_conflicts(self)); |
|
508
|
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
510
|
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
void |
|
512
|
|
|
|
|
|
|
conflicts(self) |
|
513
|
|
|
|
|
|
|
SV *self |
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
PREINIT: |
|
516
|
|
|
|
|
|
|
int rc; |
|
517
|
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
SV *repo; |
|
519
|
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
git_index_conflict_iterator *iter; |
|
521
|
|
|
|
|
|
|
const git_index_entry *ancestor, *ours, *theirs; |
|
522
|
|
|
|
|
|
|
|
|
523
|
1
|
|
|
|
|
|
size_t num_conflicts = 0; |
|
524
|
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
PPCODE: |
|
526
|
1
|
|
|
|
|
|
rc = git_index_conflict_iterator_new( |
|
527
|
1
|
|
|
|
|
|
&iter, GIT_SV_TO_PTR(Index, self) |
|
528
|
|
|
|
|
|
|
); |
|
529
|
1
|
|
|
|
|
|
git_check_error(rc); |
|
530
|
|
|
|
|
|
|
|
|
531
|
1
|
|
|
|
|
|
repo = GIT_SV_TO_MAGIC(self); |
|
532
|
|
|
|
|
|
|
|
|
533
|
2
|
100
|
|
|
|
|
while ((rc = git_index_conflict_next( |
|
534
|
|
|
|
|
|
|
&ancestor, &ours, &theirs, iter)) == GIT_OK) { |
|
535
|
1
|
|
|
|
|
|
SV *c = NULL; |
|
536
|
1
|
|
|
|
|
|
Index_Conflict conflict = NULL; |
|
537
|
1
|
|
|
|
|
|
Newxz(conflict, 1, git_raw_index_conflict); |
|
538
|
|
|
|
|
|
|
|
|
539
|
1
|
|
|
|
|
|
conflict -> ancestor = git_index_entry_dup(ancestor, NULL); |
|
540
|
1
|
|
|
|
|
|
conflict -> ours = git_index_entry_dup(ours, NULL); |
|
541
|
1
|
|
|
|
|
|
conflict -> theirs = git_index_entry_dup(theirs, NULL); |
|
542
|
|
|
|
|
|
|
|
|
543
|
1
|
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
|
544
|
|
|
|
|
|
|
c, "Git::Raw::Index::Conflict", |
|
545
|
|
|
|
|
|
|
conflict, repo |
|
546
|
|
|
|
|
|
|
); |
|
547
|
|
|
|
|
|
|
|
|
548
|
1
|
|
|
|
|
|
num_conflicts++; |
|
549
|
|
|
|
|
|
|
|
|
550
|
1
|
50
|
|
|
|
|
mXPUSHs(c); |
|
551
|
|
|
|
|
|
|
} |
|
552
|
|
|
|
|
|
|
|
|
553
|
1
|
|
|
|
|
|
git_index_conflict_iterator_free(iter); |
|
554
|
1
|
|
|
|
|
|
git_check_error(rc); |
|
555
|
|
|
|
|
|
|
|
|
556
|
1
|
|
|
|
|
|
XSRETURN(num_conflicts); |
|
557
|
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
void |
|
559
|
|
|
|
|
|
|
update_all(self, opts) |
|
560
|
|
|
|
|
|
|
Index self |
|
561
|
|
|
|
|
|
|
HV *opts |
|
562
|
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
PREINIT: |
|
564
|
|
|
|
|
|
|
int rc; |
|
565
|
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
SV *callback; |
|
567
|
|
|
|
|
|
|
AV *lopt; |
|
568
|
4
|
|
|
|
|
|
git_strarray paths = {0, 0}; |
|
569
|
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
CODE: |
|
571
|
4
|
50
|
|
|
|
|
if ((lopt = git_hv_list_entry(opts, "paths"))) |
|
572
|
4
|
|
|
|
|
|
git_list_to_paths(lopt, &paths); |
|
573
|
|
|
|
|
|
|
|
|
574
|
4
|
|
|
|
|
|
callback = get_callback_option(opts, "notification"); |
|
575
|
|
|
|
|
|
|
|
|
576
|
4
|
|
|
|
|
|
rc = git_index_update_all( |
|
577
|
|
|
|
|
|
|
self, |
|
578
|
|
|
|
|
|
|
&paths, |
|
579
|
|
|
|
|
|
|
git_index_matched_path_cbb, |
|
580
|
|
|
|
|
|
|
callback); |
|
581
|
4
|
|
|
|
|
|
Safefree(paths.strings); |
|
582
|
4
|
|
|
|
|
|
git_check_error(rc); |
|
583
|
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
void |
|
585
|
|
|
|
|
|
|
capabilities(self) |
|
586
|
|
|
|
|
|
|
Index self |
|
587
|
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
PREINIT: |
|
589
|
3
|
50
|
|
|
|
|
int ctx = GIMME_V; |
|
590
|
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
PPCODE: |
|
592
|
3
|
100
|
|
|
|
|
if (ctx != G_VOID) { |
|
593
|
2
|
100
|
|
|
|
|
if (ctx == G_ARRAY) { |
|
594
|
1
|
|
|
|
|
|
int caps = git_index_caps(self); |
|
595
|
|
|
|
|
|
|
|
|
596
|
1
|
50
|
|
|
|
|
mXPUSHs(newSVpv("ignore_case", 0)); |
|
597
|
1
|
50
|
|
|
|
|
mXPUSHs(newSViv((caps & GIT_INDEXCAP_IGNORE_CASE) ? 1 : 0)); |
|
598
|
1
|
50
|
|
|
|
|
mXPUSHs(newSVpv("no_filemode", 0)); |
|
599
|
1
|
50
|
|
|
|
|
mXPUSHs(newSViv((caps & GIT_INDEXCAP_NO_FILEMODE) ? 1 : 0)); |
|
600
|
1
|
50
|
|
|
|
|
mXPUSHs(newSVpv("no_symlinks", 0)); |
|
601
|
1
|
50
|
|
|
|
|
mXPUSHs(newSViv((caps & GIT_INDEXCAP_NO_SYMLINKS) ? 1 : 0)); |
|
602
|
|
|
|
|
|
|
|
|
603
|
1
|
|
|
|
|
|
XSRETURN(6); |
|
604
|
|
|
|
|
|
|
} else { |
|
605
|
1
|
50
|
|
|
|
|
mXPUSHs(newSViv(3)); |
|
606
|
1
|
|
|
|
|
|
XSRETURN(1); |
|
607
|
|
|
|
|
|
|
} |
|
608
|
|
|
|
|
|
|
} else |
|
609
|
1
|
|
|
|
|
|
XSRETURN_EMPTY; |
|
610
|
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
SV * |
|
612
|
|
|
|
|
|
|
version(self, ...) |
|
613
|
|
|
|
|
|
|
Index self |
|
614
|
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
PROTOTYPE: $;$ |
|
616
|
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
CODE: |
|
618
|
3
|
100
|
|
|
|
|
if (items == 2) { |
|
619
|
1
|
|
|
|
|
|
int rc = git_index_set_version(self, |
|
620
|
1
|
|
|
|
|
|
(unsigned int)git_ensure_iv(ST(1), "version")); |
|
621
|
1
|
|
|
|
|
|
git_check_error(rc); |
|
622
|
|
|
|
|
|
|
} |
|
623
|
|
|
|
|
|
|
|
|
624
|
3
|
|
|
|
|
|
RETVAL = newSViv (git_index_version(self)); |
|
625
|
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
627
|
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
void |
|
629
|
|
|
|
|
|
|
DESTROY(self) |
|
630
|
|
|
|
|
|
|
SV* self |
|
631
|
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
CODE: |
|
633
|
21
|
|
|
|
|
|
git_index_free(GIT_SV_TO_PTR(Index, self)); |
|
634
|
21
|
|
|
|
|
|
SvREFCNT_dec(GIT_SV_TO_MAGIC(self)); |