line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
MODULE = Git::Raw PACKAGE = Git::Raw::Remote |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
SV * |
4
|
|
|
|
|
|
|
create(class, repo, name, url, ...) |
5
|
|
|
|
|
|
|
SV *class |
6
|
|
|
|
|
|
|
SV *repo |
7
|
|
|
|
|
|
|
SV *name |
8
|
|
|
|
|
|
|
SV *url |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
PREINIT: |
11
|
|
|
|
|
|
|
int rc; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
|
|
|
git_remote *r = NULL; |
14
|
3
|
|
|
|
|
|
Remote remote = NULL; |
15
|
3
|
|
|
|
|
|
Repository repo_ptr = NULL; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
CODE: |
18
|
3
|
|
|
|
|
|
repo_ptr = GIT_SV_TO_PTR(Repository, repo); |
19
|
|
|
|
|
|
|
|
20
|
3
|
100
|
|
|
|
|
if (items >= 5) { |
21
|
1
|
|
|
|
|
|
rc = git_remote_create_with_fetchspec( |
22
|
|
|
|
|
|
|
&r, repo_ptr -> repository, |
23
|
|
|
|
|
|
|
git_ensure_pv(name, "name"), git_ensure_pv(url, "url"), |
24
|
1
|
|
|
|
|
|
git_ensure_pv(ST(4), "spec") |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
} else { |
27
|
2
|
|
|
|
|
|
rc = git_remote_create( |
28
|
|
|
|
|
|
|
&r, repo_ptr -> repository, |
29
|
|
|
|
|
|
|
git_ensure_pv(name, "name"), git_ensure_pv(url, "url") |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
|
|
|
git_check_error(rc); |
34
|
|
|
|
|
|
|
|
35
|
3
|
|
|
|
|
|
Newxz(remote, 1, git_raw_remote); |
36
|
3
|
|
|
|
|
|
remote -> remote = r; |
37
|
3
|
|
|
|
|
|
remote -> owned = 1; |
38
|
|
|
|
|
|
|
|
39
|
3
|
50
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
40
|
|
|
|
|
|
|
RETVAL, SvPVbyte_nolen(class), remote, SvRV(repo) |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
OUTPUT: RETVAL |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
SV * |
46
|
|
|
|
|
|
|
create_anonymous(class, repo, url) |
47
|
|
|
|
|
|
|
SV *class |
48
|
|
|
|
|
|
|
SV *repo |
49
|
|
|
|
|
|
|
SV *url |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
PREINIT: |
52
|
|
|
|
|
|
|
int rc; |
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
|
git_remote *r = NULL; |
55
|
2
|
|
|
|
|
|
Remote remote = NULL; |
56
|
2
|
|
|
|
|
|
Repository repo_ptr = NULL; |
57
|
|
|
|
|
|
|
|
58
|
2
|
|
|
|
|
|
const char *f = NULL; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
CODE: |
61
|
2
|
|
|
|
|
|
repo_ptr = GIT_SV_TO_PTR(Repository, repo); |
62
|
2
|
|
|
|
|
|
rc = git_remote_create_anonymous( |
63
|
|
|
|
|
|
|
&r, repo_ptr -> repository, |
64
|
|
|
|
|
|
|
git_ensure_pv(url, "url") |
65
|
|
|
|
|
|
|
); |
66
|
2
|
|
|
|
|
|
git_check_error(rc); |
67
|
|
|
|
|
|
|
|
68
|
2
|
|
|
|
|
|
Newx(remote, 1, git_raw_remote); |
69
|
2
|
|
|
|
|
|
remote -> remote = r; |
70
|
|
|
|
|
|
|
|
71
|
2
|
50
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
72
|
|
|
|
|
|
|
RETVAL, SvPVbyte_nolen(class), remote, SvRV(repo) |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
OUTPUT: RETVAL |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
SV * |
78
|
|
|
|
|
|
|
load(class, repo, name) |
79
|
|
|
|
|
|
|
SV *class |
80
|
|
|
|
|
|
|
SV *repo |
81
|
|
|
|
|
|
|
SV *name |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
PREINIT: |
84
|
|
|
|
|
|
|
int rc; |
85
|
|
|
|
|
|
|
|
86
|
1
|
|
|
|
|
|
git_remote *r = NULL; |
87
|
1
|
|
|
|
|
|
Repository repo_ptr = NULL; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
CODE: |
90
|
1
|
|
|
|
|
|
repo_ptr = GIT_SV_TO_PTR(Repository, repo); |
91
|
1
|
|
|
|
|
|
rc = git_remote_lookup( |
92
|
|
|
|
|
|
|
&r, repo_ptr -> repository, |
93
|
|
|
|
|
|
|
git_ensure_pv(name, "name")); |
94
|
1
|
50
|
|
|
|
|
if (rc == GIT_ENOTFOUND) { |
95
|
0
|
|
|
|
|
|
RETVAL = &PL_sv_undef; |
96
|
|
|
|
|
|
|
} else { |
97
|
1
|
|
|
|
|
|
Remote remote = NULL; |
98
|
1
|
|
|
|
|
|
git_check_error(rc); |
99
|
|
|
|
|
|
|
|
100
|
1
|
|
|
|
|
|
Newx(remote, 1, git_raw_remote); |
101
|
1
|
|
|
|
|
|
remote -> remote = r; |
102
|
|
|
|
|
|
|
|
103
|
1
|
50
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
104
|
|
|
|
|
|
|
RETVAL, SvPVbyte_nolen(class), remote, SvRV(repo) |
105
|
|
|
|
|
|
|
); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
OUTPUT: RETVAL |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
void |
111
|
|
|
|
|
|
|
delete(class, repo, name) |
112
|
|
|
|
|
|
|
SV *class |
113
|
|
|
|
|
|
|
SV *repo |
114
|
|
|
|
|
|
|
SV *name |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
PREINIT: |
117
|
|
|
|
|
|
|
int rc; |
118
|
|
|
|
|
|
|
|
119
|
1
|
|
|
|
|
|
git_remote *r = NULL; |
120
|
1
|
|
|
|
|
|
Repository repo_ptr = NULL; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
CODE: |
123
|
1
|
|
|
|
|
|
repo_ptr = GIT_SV_TO_PTR(Repository, repo); |
124
|
1
|
|
|
|
|
|
rc = git_remote_delete(repo_ptr -> repository, |
125
|
|
|
|
|
|
|
git_ensure_pv(name, "name")); |
126
|
|
|
|
|
|
|
|
127
|
1
|
|
|
|
|
|
git_check_error(rc); |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
SV * |
131
|
|
|
|
|
|
|
owner(self) |
132
|
|
|
|
|
|
|
SV *self |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
PREINIT: |
135
|
|
|
|
|
|
|
SV *repo; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
CODE: |
138
|
1
|
|
|
|
|
|
repo = GIT_SV_TO_MAGIC(self); |
139
|
1
|
|
|
|
|
|
RETVAL = newRV_inc(repo); |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
OUTPUT: RETVAL |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
SV * |
144
|
|
|
|
|
|
|
default_branch(self) |
145
|
|
|
|
|
|
|
Remote self |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
PREINIT: |
148
|
|
|
|
|
|
|
int rc; |
149
|
|
|
|
|
|
|
|
150
|
0
|
|
|
|
|
|
git_buf buf = GIT_BUF_INIT_CONST(NULL, 0); |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
CODE: |
153
|
0
|
|
|
|
|
|
rc = git_remote_default_branch(&buf, self -> remote); |
154
|
0
|
0
|
|
|
|
|
if (rc == GIT_ENOTFOUND) { |
155
|
0
|
|
|
|
|
|
RETVAL = &PL_sv_undef; |
156
|
|
|
|
|
|
|
} else { |
157
|
0
|
0
|
|
|
|
|
if (rc != GIT_OK) |
158
|
0
|
|
|
|
|
|
git_buf_dispose(&buf); |
159
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
git_check_error(rc); |
161
|
0
|
|
|
|
|
|
RETVAL = newSVpv(buf.ptr, buf.size); |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
|
git_buf_dispose(&buf); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
OUTPUT: RETVAL |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
SV * |
169
|
|
|
|
|
|
|
name(self) |
170
|
|
|
|
|
|
|
Remote self |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
CODE: |
173
|
4
|
|
|
|
|
|
RETVAL = newSVpv(git_remote_name(self -> remote), 0); |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
OUTPUT: RETVAL |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
void |
178
|
|
|
|
|
|
|
rename(class, repo, old_name, new_name, ...) |
179
|
|
|
|
|
|
|
const char *class |
180
|
|
|
|
|
|
|
Repository repo |
181
|
|
|
|
|
|
|
const char *old_name |
182
|
|
|
|
|
|
|
const char *new_name |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
PROTOTYPE: $$$$;$ |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
PREINIT: |
187
|
|
|
|
|
|
|
int rc; |
188
|
|
|
|
|
|
|
|
189
|
1
|
|
|
|
|
|
AV *p = NULL; |
190
|
|
|
|
|
|
|
Remote remote; |
191
|
1
|
|
|
|
|
|
git_strarray problems = {NULL, 0}; |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
CODE: |
194
|
1
|
50
|
|
|
|
|
if (items >= 5) |
195
|
1
|
|
|
|
|
|
p = git_ensure_av(ST(4), "problems"); |
196
|
|
|
|
|
|
|
|
197
|
1
|
|
|
|
|
|
rc = git_remote_rename(&problems, repo -> repository, |
198
|
|
|
|
|
|
|
old_name, new_name); |
199
|
1
|
|
|
|
|
|
git_check_error(rc); |
200
|
|
|
|
|
|
|
|
201
|
1
|
50
|
|
|
|
|
if (p != NULL && problems.count > 0) { |
|
|
50
|
|
|
|
|
|
202
|
|
|
|
|
|
|
size_t i; |
203
|
0
|
0
|
|
|
|
|
for (i = 0; i < problems.count; ++i) |
204
|
0
|
|
|
|
|
|
av_push(p, newSVpv(problems.strings[i], 0)); |
205
|
|
|
|
|
|
|
} |
206
|
1
|
|
|
|
|
|
git_strarray_free(&problems); |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
SV * |
209
|
|
|
|
|
|
|
url(self, ...) |
210
|
|
|
|
|
|
|
SV *self |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
PROTOTYPE: $;$ |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
PREINIT: |
215
|
|
|
|
|
|
|
int rc; |
216
|
|
|
|
|
|
|
const char *url; |
217
|
|
|
|
|
|
|
|
218
|
3
|
|
|
|
|
|
Remote remote = NULL; |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
CODE: |
221
|
3
|
|
|
|
|
|
remote = GIT_SV_TO_PTR(Remote, self); |
222
|
|
|
|
|
|
|
|
223
|
3
|
100
|
|
|
|
|
if (items == 2) { |
224
|
1
|
|
|
|
|
|
url = git_ensure_pv(ST(1), "url"); |
225
|
|
|
|
|
|
|
|
226
|
1
|
|
|
|
|
|
rc = git_remote_set_url( |
227
|
1
|
|
|
|
|
|
git_remote_owner(remote -> remote), |
228
|
1
|
|
|
|
|
|
git_remote_name(remote -> remote), |
229
|
|
|
|
|
|
|
url |
230
|
|
|
|
|
|
|
); |
231
|
1
|
|
|
|
|
|
git_check_error(rc); |
232
|
1
|
|
|
|
|
|
RETVAL = newSVpv(url, 0); |
233
|
|
|
|
|
|
|
} else { |
234
|
2
|
|
|
|
|
|
RETVAL = &PL_sv_undef; |
235
|
2
|
50
|
|
|
|
|
if ((url = git_remote_url(remote -> remote))) |
236
|
2
|
|
|
|
|
|
RETVAL = newSVpv(url, 0); |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
OUTPUT: RETVAL |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
SV * |
243
|
|
|
|
|
|
|
pushurl(self, ...) |
244
|
|
|
|
|
|
|
SV *self |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
PROTOTYPE: $;$ |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
PREINIT: |
249
|
|
|
|
|
|
|
int rc; |
250
|
|
|
|
|
|
|
const char *pushurl; |
251
|
|
|
|
|
|
|
|
252
|
2
|
|
|
|
|
|
Remote remote = NULL; |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
CODE: |
255
|
2
|
|
|
|
|
|
remote = GIT_SV_TO_PTR(Remote, self); |
256
|
|
|
|
|
|
|
|
257
|
2
|
100
|
|
|
|
|
if (items == 2) { |
258
|
1
|
|
|
|
|
|
pushurl = git_ensure_pv(ST(1), "pushurl"); |
259
|
|
|
|
|
|
|
|
260
|
1
|
|
|
|
|
|
rc = git_remote_set_pushurl( |
261
|
1
|
|
|
|
|
|
git_remote_owner(remote -> remote), |
262
|
1
|
|
|
|
|
|
git_remote_name(remote -> remote), |
263
|
|
|
|
|
|
|
pushurl |
264
|
|
|
|
|
|
|
); |
265
|
1
|
|
|
|
|
|
git_check_error(rc); |
266
|
1
|
|
|
|
|
|
RETVAL = newSVpv(pushurl, 0); |
267
|
|
|
|
|
|
|
} else { |
268
|
1
|
|
|
|
|
|
RETVAL = &PL_sv_undef; |
269
|
1
|
50
|
|
|
|
|
if ((pushurl = git_remote_pushurl(remote -> remote))) |
270
|
0
|
|
|
|
|
|
RETVAL = newSVpv(pushurl, 0); |
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
OUTPUT: RETVAL |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
void |
277
|
|
|
|
|
|
|
add_fetch(self, spec) |
278
|
|
|
|
|
|
|
SV *self |
279
|
|
|
|
|
|
|
SV *spec |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
PREINIT: |
282
|
|
|
|
|
|
|
int rc; |
283
|
|
|
|
|
|
|
|
284
|
0
|
|
|
|
|
|
Remote remote = NULL; |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
CODE: |
287
|
0
|
|
|
|
|
|
remote = GIT_SV_TO_PTR(Remote, self); |
288
|
|
|
|
|
|
|
|
289
|
0
|
|
|
|
|
|
rc = git_remote_add_fetch( |
290
|
0
|
|
|
|
|
|
git_remote_owner(remote -> remote), |
291
|
0
|
|
|
|
|
|
git_remote_name(remote -> remote), |
292
|
|
|
|
|
|
|
git_ensure_pv(spec, "spec")); |
293
|
0
|
|
|
|
|
|
git_check_error(rc); |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
void |
296
|
|
|
|
|
|
|
add_push(self, spec) |
297
|
|
|
|
|
|
|
SV *self |
298
|
|
|
|
|
|
|
SV *spec |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
PREINIT: |
301
|
|
|
|
|
|
|
int rc; |
302
|
|
|
|
|
|
|
|
303
|
0
|
|
|
|
|
|
Remote remote = NULL; |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
CODE: |
306
|
0
|
|
|
|
|
|
remote = GIT_SV_TO_PTR(Remote, self); |
307
|
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
|
rc = git_remote_add_push( |
309
|
0
|
|
|
|
|
|
git_remote_owner(remote -> remote), |
310
|
0
|
|
|
|
|
|
git_remote_name(remote -> remote), |
311
|
|
|
|
|
|
|
git_ensure_pv(spec, "spec")); |
312
|
0
|
|
|
|
|
|
git_check_error(rc); |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
void |
315
|
|
|
|
|
|
|
refspecs(self) |
316
|
|
|
|
|
|
|
SV *self |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
PREINIT: |
319
|
|
|
|
|
|
|
size_t i, count; |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
Remote remote_ptr; |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
PPCODE: |
324
|
3
|
|
|
|
|
|
remote_ptr = GIT_SV_TO_PTR(Remote, self); |
325
|
|
|
|
|
|
|
|
326
|
3
|
|
|
|
|
|
count = git_remote_refspec_count(remote_ptr -> remote); |
327
|
|
|
|
|
|
|
|
328
|
6
|
100
|
|
|
|
|
for (i = 0; i < count; ++i) { |
329
|
|
|
|
|
|
|
RefSpec spec; |
330
|
|
|
|
|
|
|
const git_refspec *s; |
331
|
|
|
|
|
|
|
SV *tmp; |
332
|
|
|
|
|
|
|
|
333
|
3
|
|
|
|
|
|
s = git_remote_get_refspec( |
334
|
3
|
|
|
|
|
|
remote_ptr -> remote, |
335
|
|
|
|
|
|
|
i |
336
|
|
|
|
|
|
|
); |
337
|
|
|
|
|
|
|
|
338
|
3
|
|
|
|
|
|
Newxz(spec, 1, git_raw_refspec); |
339
|
3
|
|
|
|
|
|
spec -> refspec = (git_refspec *)s; |
340
|
3
|
|
|
|
|
|
spec -> owned = 0; |
341
|
|
|
|
|
|
|
|
342
|
3
|
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
343
|
|
|
|
|
|
|
tmp, "Git::Raw::RefSpec", spec, SvRV(self) |
344
|
|
|
|
|
|
|
); |
345
|
|
|
|
|
|
|
|
346
|
3
|
50
|
|
|
|
|
mXPUSHs(tmp); |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
|
349
|
3
|
|
|
|
|
|
XSRETURN(count); |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
SV * |
352
|
|
|
|
|
|
|
refspec_count(self) |
353
|
|
|
|
|
|
|
Remote self |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
CODE: |
356
|
1
|
|
|
|
|
|
RETVAL = newSVuv(git_remote_refspec_count(self -> remote)); |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
OUTPUT: RETVAL |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
void |
361
|
|
|
|
|
|
|
fetch(self, ...) |
362
|
|
|
|
|
|
|
Remote self |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
PREINIT: |
365
|
|
|
|
|
|
|
int rc; |
366
|
|
|
|
|
|
|
|
367
|
0
|
|
|
|
|
|
git_fetch_options fetch_opts = GIT_FETCH_OPTIONS_INIT; |
368
|
0
|
|
|
|
|
|
git_strarray specs = {NULL, 0}; |
369
|
0
|
|
|
|
|
|
git_strarray *refspecs = NULL; |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
CODE: |
372
|
0
|
0
|
|
|
|
|
if (items >= 2) { |
373
|
0
|
|
|
|
|
|
HV *opts = git_ensure_hv(ST(1), "fetch_opts"); |
374
|
0
|
|
|
|
|
|
git_hv_to_fetch_opts(opts, &fetch_opts); |
375
|
|
|
|
|
|
|
} |
376
|
|
|
|
|
|
|
|
377
|
0
|
0
|
|
|
|
|
if (items >= 3) { |
378
|
0
|
|
|
|
|
|
git_list_to_paths( |
379
|
0
|
|
|
|
|
|
git_ensure_av(ST(2), "refspecs"), |
380
|
|
|
|
|
|
|
&specs |
381
|
|
|
|
|
|
|
); |
382
|
0
|
|
|
|
|
|
refspecs = &specs; |
383
|
|
|
|
|
|
|
} |
384
|
|
|
|
|
|
|
|
385
|
0
|
|
|
|
|
|
rc = git_remote_fetch(self -> remote, refspecs, |
386
|
|
|
|
|
|
|
&fetch_opts, NULL |
387
|
|
|
|
|
|
|
); |
388
|
0
|
0
|
|
|
|
|
if (refspecs) { |
389
|
0
|
|
|
|
|
|
Safefree(specs.strings); |
390
|
|
|
|
|
|
|
} |
391
|
0
|
|
|
|
|
|
git_check_error(rc); |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
void |
394
|
|
|
|
|
|
|
push(self, refspecs, ...) |
395
|
|
|
|
|
|
|
Remote self |
396
|
|
|
|
|
|
|
SV *refspecs |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
PREINIT: |
399
|
|
|
|
|
|
|
int rc; |
400
|
|
|
|
|
|
|
|
401
|
0
|
|
|
|
|
|
git_push_options push_opts = GIT_PUSH_OPTIONS_INIT; |
402
|
0
|
|
|
|
|
|
git_strarray specs = {NULL, 0}; |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
PPCODE: |
405
|
0
|
|
|
|
|
|
git_list_to_paths( |
406
|
|
|
|
|
|
|
git_ensure_av(refspecs, "refspecs"), |
407
|
|
|
|
|
|
|
&specs |
408
|
|
|
|
|
|
|
); |
409
|
|
|
|
|
|
|
|
410
|
0
|
0
|
|
|
|
|
if (items >= 3) { |
411
|
0
|
|
|
|
|
|
HV *opts = git_ensure_hv(ST(2), "push_opts"); |
412
|
0
|
|
|
|
|
|
git_hv_to_push_opts(opts, &push_opts); |
413
|
|
|
|
|
|
|
} |
414
|
|
|
|
|
|
|
|
415
|
0
|
|
|
|
|
|
rc = git_remote_push(self -> remote, &specs, &push_opts); |
416
|
0
|
|
|
|
|
|
Safefree(specs.strings); |
417
|
|
|
|
|
|
|
|
418
|
0
|
0
|
|
|
|
|
if (rc == GIT_OK || rc == GIT_EUSER) |
|
|
0
|
|
|
|
|
|
419
|
0
|
|
|
|
|
|
XSRETURN_YES; |
420
|
0
|
|
|
|
|
|
git_check_error(rc); |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
void |
423
|
|
|
|
|
|
|
connect(self, direction, ...) |
424
|
|
|
|
|
|
|
Remote self |
425
|
|
|
|
|
|
|
SV *direction |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
PREINIT: |
428
|
|
|
|
|
|
|
int rc; |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
const char *dir; |
431
|
0
|
|
|
|
|
|
git_direction direct = GIT_DIRECTION_FETCH; |
432
|
0
|
|
|
|
|
|
git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT; |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
CODE: |
435
|
0
|
|
|
|
|
|
dir = git_ensure_pv(direction, "direction"); |
436
|
|
|
|
|
|
|
|
437
|
0
|
0
|
|
|
|
|
if (strcmp(dir, "fetch") == 0) |
438
|
0
|
|
|
|
|
|
direct = GIT_DIRECTION_FETCH; |
439
|
0
|
0
|
|
|
|
|
else if (strcmp(dir, "push") == 0) |
440
|
0
|
|
|
|
|
|
direct = GIT_DIRECTION_PUSH; |
441
|
|
|
|
|
|
|
else |
442
|
0
|
|
|
|
|
|
croak_usage("Invalid direction '%s'. " |
443
|
|
|
|
|
|
|
"Valid values: 'fetch' or 'push'", dir); |
444
|
|
|
|
|
|
|
|
445
|
0
|
0
|
|
|
|
|
if (items >= 3) { |
446
|
0
|
|
|
|
|
|
git_hv_to_remote_callbacks( |
447
|
0
|
|
|
|
|
|
git_ensure_hv(ST(2), "callbacks"), |
448
|
|
|
|
|
|
|
&callbacks |
449
|
|
|
|
|
|
|
); |
450
|
|
|
|
|
|
|
} |
451
|
|
|
|
|
|
|
|
452
|
0
|
|
|
|
|
|
rc = git_remote_connect(self -> remote, direct, &callbacks, NULL, NULL); |
453
|
0
|
|
|
|
|
|
git_check_error(rc); |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
void |
456
|
|
|
|
|
|
|
disconnect(self) |
457
|
|
|
|
|
|
|
Remote self |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
CODE: |
460
|
0
|
|
|
|
|
|
git_remote_disconnect(self -> remote); |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
void |
463
|
|
|
|
|
|
|
download(self, ...) |
464
|
|
|
|
|
|
|
Remote self |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
PREINIT: |
467
|
|
|
|
|
|
|
int rc; |
468
|
|
|
|
|
|
|
|
469
|
0
|
|
|
|
|
|
git_fetch_options fetch_opts = GIT_FETCH_OPTIONS_INIT; |
470
|
0
|
|
|
|
|
|
git_strarray specs = {NULL, 0}; |
471
|
0
|
|
|
|
|
|
git_strarray *refspecs = NULL; |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
CODE: |
474
|
0
|
0
|
|
|
|
|
if (items >= 2) { |
475
|
0
|
|
|
|
|
|
HV *opts = git_ensure_hv(ST(1), "fetch_opts"); |
476
|
0
|
|
|
|
|
|
git_hv_to_fetch_opts(opts, &fetch_opts); |
477
|
|
|
|
|
|
|
} |
478
|
|
|
|
|
|
|
|
479
|
0
|
0
|
|
|
|
|
if (items >= 3) { |
480
|
0
|
|
|
|
|
|
git_list_to_paths( |
481
|
0
|
|
|
|
|
|
git_ensure_av(ST(2), "refspecs"), |
482
|
|
|
|
|
|
|
&specs |
483
|
|
|
|
|
|
|
); |
484
|
0
|
|
|
|
|
|
refspecs = &specs; |
485
|
|
|
|
|
|
|
} |
486
|
|
|
|
|
|
|
|
487
|
0
|
|
|
|
|
|
rc = git_remote_download(self -> remote, refspecs, |
488
|
|
|
|
|
|
|
&fetch_opts |
489
|
|
|
|
|
|
|
); |
490
|
0
|
0
|
|
|
|
|
if (refspecs) { |
491
|
0
|
|
|
|
|
|
Safefree(specs.strings); |
492
|
|
|
|
|
|
|
} |
493
|
0
|
|
|
|
|
|
git_check_error(rc); |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
void |
496
|
|
|
|
|
|
|
upload(self, refspecs, ...) |
497
|
|
|
|
|
|
|
Remote self |
498
|
|
|
|
|
|
|
SV *refspecs |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
PREINIT: |
501
|
|
|
|
|
|
|
int rc; |
502
|
2
|
|
|
|
|
|
git_push_options push_opts = GIT_PUSH_OPTIONS_INIT; |
503
|
2
|
|
|
|
|
|
git_strarray specs = {NULL, 0}; |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
PPCODE: |
506
|
2
|
|
|
|
|
|
git_list_to_paths( |
507
|
|
|
|
|
|
|
git_ensure_av(refspecs, "refspecs"), |
508
|
|
|
|
|
|
|
&specs |
509
|
|
|
|
|
|
|
); |
510
|
|
|
|
|
|
|
|
511
|
2
|
50
|
|
|
|
|
if (items >= 3) { |
512
|
2
|
|
|
|
|
|
HV *opts = git_ensure_hv(ST(2), "push_opts"); |
513
|
2
|
|
|
|
|
|
git_hv_to_push_opts(opts, &push_opts); |
514
|
|
|
|
|
|
|
} |
515
|
|
|
|
|
|
|
|
516
|
2
|
|
|
|
|
|
rc = git_remote_upload(self -> remote, &specs, &push_opts); |
517
|
2
|
|
|
|
|
|
Safefree(specs.strings); |
518
|
|
|
|
|
|
|
|
519
|
2
|
50
|
|
|
|
|
if (rc == GIT_OK || rc == GIT_EUSER) |
|
|
0
|
|
|
|
|
|
520
|
2
|
|
|
|
|
|
XSRETURN_YES; |
521
|
0
|
|
|
|
|
|
git_check_error(rc); |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
void |
524
|
|
|
|
|
|
|
prune(self, ...) |
525
|
|
|
|
|
|
|
Remote self |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
PREINIT: |
528
|
|
|
|
|
|
|
int rc; |
529
|
|
|
|
|
|
|
|
530
|
0
|
|
|
|
|
|
git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT; |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
CODE: |
533
|
0
|
0
|
|
|
|
|
if (items >= 2) { |
534
|
0
|
|
|
|
|
|
git_hv_to_remote_callbacks( |
535
|
0
|
|
|
|
|
|
git_ensure_hv(ST(1), "callbacks"), |
536
|
|
|
|
|
|
|
&callbacks |
537
|
|
|
|
|
|
|
); |
538
|
|
|
|
|
|
|
} |
539
|
|
|
|
|
|
|
|
540
|
0
|
|
|
|
|
|
rc = git_remote_prune(self -> remote, &callbacks); |
541
|
0
|
|
|
|
|
|
git_check_error(rc); |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
void |
544
|
|
|
|
|
|
|
update_tips(self, ...) |
545
|
|
|
|
|
|
|
Remote self |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
PREINIT: |
548
|
|
|
|
|
|
|
int rc; |
549
|
|
|
|
|
|
|
|
550
|
0
|
|
|
|
|
|
git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT; |
551
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
CODE: |
553
|
0
|
0
|
|
|
|
|
if (items >= 2) { |
554
|
0
|
|
|
|
|
|
git_hv_to_remote_callbacks( |
555
|
0
|
|
|
|
|
|
git_ensure_hv(ST(1), "callbacks"), |
556
|
|
|
|
|
|
|
&callbacks |
557
|
|
|
|
|
|
|
); |
558
|
|
|
|
|
|
|
} |
559
|
|
|
|
|
|
|
|
560
|
0
|
|
|
|
|
|
rc = git_remote_update_tips(self -> remote, &callbacks, |
561
|
|
|
|
|
|
|
1, GIT_REMOTE_DOWNLOAD_TAGS_NONE, NULL |
562
|
|
|
|
|
|
|
); |
563
|
0
|
|
|
|
|
|
git_check_error(rc); |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
SV * |
566
|
|
|
|
|
|
|
ls(self) |
567
|
|
|
|
|
|
|
Remote self |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
PREINIT: |
570
|
|
|
|
|
|
|
int rc; |
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
size_t i, count; |
573
|
0
|
|
|
|
|
|
const char *peel = "^{}"; |
574
|
|
|
|
|
|
|
const git_remote_head **refs; |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
HV *r; |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
CODE: |
579
|
0
|
|
|
|
|
|
rc = git_remote_ls(&refs, &count, self -> remote); |
580
|
0
|
|
|
|
|
|
git_check_error(rc); |
581
|
|
|
|
|
|
|
|
582
|
0
|
|
|
|
|
|
r = newHV(); |
583
|
|
|
|
|
|
|
|
584
|
0
|
0
|
|
|
|
|
for (i = 0; i < count; ++i) { |
585
|
|
|
|
|
|
|
size_t len; |
586
|
|
|
|
|
|
|
const char *ref_name; |
587
|
|
|
|
|
|
|
|
588
|
0
|
|
|
|
|
|
HV *entry = newHV(); |
589
|
0
|
|
|
|
|
|
int local = refs[i] -> local; |
590
|
|
|
|
|
|
|
|
591
|
0
|
|
|
|
|
|
hv_stores(entry, "local", newSViv(local)); |
592
|
|
|
|
|
|
|
|
593
|
0
|
|
|
|
|
|
hv_stores(entry, "id", git_oid_to_sv(&refs[i] -> oid)); |
594
|
|
|
|
|
|
|
|
595
|
0
|
0
|
|
|
|
|
if (local) |
596
|
0
|
|
|
|
|
|
hv_stores(entry, "lid", |
597
|
|
|
|
|
|
|
git_oid_to_sv(&refs[i] -> loid)); |
598
|
|
|
|
|
|
|
|
599
|
0
|
|
|
|
|
|
ref_name = refs[i] -> name; |
600
|
0
|
|
|
|
|
|
len = strlen(ref_name) - (strstr(ref_name, peel) == NULL ? |
601
|
0
|
0
|
|
|
|
|
0 : strlen(peel)); |
602
|
|
|
|
|
|
|
|
603
|
0
|
|
|
|
|
|
hv_store(r, refs[i] -> name, len, |
604
|
|
|
|
|
|
|
newRV_noinc((SV *) entry), 0); |
605
|
|
|
|
|
|
|
} |
606
|
|
|
|
|
|
|
|
607
|
0
|
|
|
|
|
|
RETVAL = newRV_noinc((SV *) r); |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
OUTPUT: RETVAL |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
SV * |
612
|
|
|
|
|
|
|
is_connected(self) |
613
|
|
|
|
|
|
|
Remote self |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
CODE: |
616
|
0
|
|
|
|
|
|
RETVAL = newSViv(git_remote_connected(self -> remote)); |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
OUTPUT: RETVAL |
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
void |
621
|
|
|
|
|
|
|
DESTROY(self) |
622
|
|
|
|
|
|
|
SV *self |
623
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
PREINIT: |
625
|
|
|
|
|
|
|
Remote remote; |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
CODE: |
628
|
13
|
|
|
|
|
|
remote = GIT_SV_TO_PTR(Remote, self); |
629
|
|
|
|
|
|
|
|
630
|
13
|
100
|
|
|
|
|
if (remote -> owned) |
631
|
3
|
|
|
|
|
|
git_remote_free(remote -> remote); |
632
|
13
|
|
|
|
|
|
SvREFCNT_dec(GIT_SV_TO_MAGIC(self)); |
633
|
13
|
|
|
|
|
|
Safefree(remote); |