xs/Rebase.xs

filter: Statementstmt 94.7% 72 / 76 Branchbran 75.0% 21 / 28 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 89.4% 93 / 104 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« xs/Diff.xs ↑ Summary xs/PathSpec.xs »
1 MODULE = Git::Raw PACKAGE = Git::Raw::Rebase
2  
3 SV *
4 new(class, repo, branch, upstream, onto, ...)
5 SV *class
6 SV *repo
7 AnnotatedCommit branch
8 AnnotatedCommit upstream
9 AnnotatedCommit onto
10  
11 PREINIT:
12 int rc;
13  
14 Repository repo_ptr;
15 Rebase rebase;
16  
17 3 git_rebase_options rebase_options = GIT_REBASE_OPTIONS_INIT;
18  
19 CODE:
20 3 ▶ if (items >= 6) {
Branch: 1 branch
BranchTrueFalseTotal
if (items >= 6) { 2 1 3
21 2 HV *opts = git_ensure_hv(ST(5), "rebase_opts");
22 2 git_hv_to_rebase_opts(opts, &rebase_options);
23 }
24  
25 3 repo_ptr = GIT_SV_TO_PTR(Repository, repo);
26  
27 3 rc = git_rebase_init(&rebase, repo_ptr -> repository,
28 branch, upstream, onto,
29 &rebase_options
30 );
31 3 git_check_error (rc);
32  
33 6 GIT_NEW_OBJ_WITH_MAGIC(
34 RETVAL, SvPVbyte_nolen(class), rebase, SvRV(repo)
35 );
36  
37 OUTPUT: RETVAL
38  
39 void
40 abort(self)
41 Rebase self
42  
43 PREINIT:
44 int rc;
45  
46 CODE:
47 1 rc = git_rebase_abort(self);
48 1 git_check_error(rc);
49  
50 SV *
51 commit(self, author, committer)
52 SV *self
53 Signature author
54 Signature committer
55  
56 PREINIT:
57 int rc;
58  
59 SV *repo;
60 Repository repo_ptr;
61  
62 Commit commit;
63 git_oid oid;
64  
65 CODE:
66 3 repo = GIT_SV_TO_MAGIC(self);
67 3 repo_ptr = INT2PTR(Repository, SvIV((SV *) repo));
68  
69 3 rc = git_rebase_commit(&oid, GIT_SV_TO_PTR(Rebase, self),
70 author, committer,
71 NULL, NULL
72 );
73 3 git_check_error(rc);
74  
75 3 rc = git_commit_lookup(&commit,
76 repo_ptr -> repository, &oid);
77 3 git_check_error(rc);
78  
79 3 GIT_NEW_OBJ_WITH_MAGIC(
80 RETVAL, "Git::Raw::Commit",
81 commit, repo
82 );
83  
84 OUTPUT: RETVAL
85  
86 void
87 finish(self, signature)
88 Rebase self
89 Signature signature
90  
91 PREINIT:
92 int rc;
93  
94 CODE:
95 1 rc = git_rebase_finish(self, signature);
96 1 git_check_error(rc);
97  
98 SV *
99 inmemory_index(self)
100 SV *self
101  
102 PREINIT:
103 int rc;
104  
105 Index index;
106  
107 CODE:
108 1 rc = git_rebase_inmemory_index(&index,
109 1 GIT_SV_TO_PTR(Rebase, self));
110 1 git_check_error(rc);
111  
112 1 GIT_NEW_OBJ_WITH_MAGIC(
113 RETVAL, "Git::Raw::Index",
114 index, SvRV(self)
115 );
116  
117 OUTPUT: RETVAL
118  
119 SV *
120 next(self)
121 SV *self
122  
123 PREINIT:
124 int rc;
125  
126 5 Rebase_Operation op = NULL;
127  
128 CODE:
129 5 rc = git_rebase_next(&op,
130 5 GIT_SV_TO_PTR(Rebase, self)
131 );
132 5 git_check_error(rc);
133  
134 5 ▶ if (op == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if (op == NULL) 1 4 5
135 1 XSRETURN_UNDEF;
136  
137 4 GIT_NEW_OBJ_WITH_MAGIC(
138 RETVAL, "Git::Raw::Rebase::Operation",
139 op, SvRV(self)
140 );
141  
142 OUTPUT: RETVAL
143  
144 SV *
145 open(class, repo, ...)
146 SV *class
147 SV *repo
148  
149 PREINIT:
150 int rc;
151  
152 Repository repo_ptr;
153 Rebase rebase;
154  
155 1 git_rebase_options rebase_options = GIT_REBASE_OPTIONS_INIT;
156  
157 CODE:
158 /* Rebase options */
159 1 ▶ if (items >= 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (items >= 3) { 1 0 1
160 1 HV *opts = git_ensure_hv(ST(2), "rebase_opts");
161 1 git_hv_to_rebase_opts(opts, &rebase_options);
162 }
163  
164 1 repo_ptr = GIT_SV_TO_PTR(Repository, repo);
165  
166 1 rc = git_rebase_open(&rebase, repo_ptr -> repository,
167 &rebase_options
168 );
169 1 git_check_error(rc);
170  
171 2 GIT_NEW_OBJ_WITH_MAGIC(
172 RETVAL, SvPVbyte_nolen(class), rebase, SvRV(repo)
173 );
174  
175 OUTPUT: RETVAL
176  
177 SV *
178 current_operation(self)
179 SV *self
180  
181 PREINIT:
182 Rebase rebase;
183 Rebase_Operation op;
184  
185 CODE:
186 4 rebase = GIT_SV_TO_PTR(Rebase, self);
187  
188 4 ▶ if (!git_rebase_operation_entrycount(rebase))
Branch: 1 branch
BranchTrueFalseTotal
if (!git_rebase_operation_entrycount(rebase)) 1 3 4
189 1 croak_usage("Rebase has no operations");
190  
191 3 op = git_rebase_operation_byindex(rebase,
192 git_rebase_operation_current(rebase)
193 );
194  
195 3 ▶ if (op == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if (op == NULL) 1 2 3
196 1 XSRETURN_UNDEF;
197  
198 2 GIT_NEW_OBJ_WITH_MAGIC(
199 RETVAL, "Git::Raw::Rebase::Operation",
200 op, GIT_SV_TO_MAGIC(self)
201 );
202  
203 OUTPUT: RETVAL
204  
205 unsigned int
206 operation_count(self)
207 Rebase self
208  
209 CODE:
210 3 ▶ RETVAL = git_rebase_operation_entrycount(self);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = git_rebase_operation_entrycount(self); 0 3 3
211  
212 OUTPUT: RETVAL
213  
214 void
215 operations(self)
216 SV *self
217  
218 PREINIT:
219 int ctx;
220 size_t i, count;
221  
222 Rebase rebase;
223  
224 PPCODE:
225 4 ctx = GIMME_V;
226 4 ▶ if (ctx == G_VOID)
Branch: 1 branch
BranchTrueFalseTotal
if (ctx == G_VOID) 1 3 4
227 1 XSRETURN_EMPTY;
228  
229 3 rebase = GIT_SV_TO_PTR(Rebase, self);
230 3 count = git_rebase_operation_entrycount(rebase);
231  
232 3 ▶ if (ctx == G_SCALAR)
Branch: 1 branch
BranchTrueFalseTotal
if (ctx == G_SCALAR) 1 2 3
233 1 XSRETURN_IV((int) count);
234  
235 5 ▶ for (i = 0; i < count; ++i) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < count; ++i) { 3 2 5
236 SV *tmp;
237  
238 Rebase_Operation op =
239 3 git_rebase_operation_byindex(rebase, i);
240  
241 3 GIT_NEW_OBJ_WITH_MAGIC(
242 tmp, "Git::Raw::Rebase::Operation",
243 op, SvRV(self)
244 );
245 3 ▶ mXPUSHs(tmp);
Branch: 1 branch
BranchTrueFalseTotal
mXPUSHs(tmp); 0 3 3
246 }
247  
248 2 XSRETURN((int) count);
249  
250 SV *
251 orig_head_name(self)
252 Rebase self
253  
254 CODE:
255 1 const char *head_name = git_rebase_orig_head_name(self);
256 1 ▶ if (head_name == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if (head_name == NULL) 1 0 1
257 1 XSRETURN_UNDEF;
258  
259 0 RETVAL = newSVpv (head_name, 0);
260  
261 OUTPUT: RETVAL
262  
263 SV *
264 orig_head_id(self)
265 Rebase self
266  
267 CODE:
268 1 const git_oid *oid = git_rebase_orig_head_id(self);
269 1 ▶ if (oid == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if (oid == NULL) 0 1 1
270 0 XSRETURN_UNDEF;
271  
272 1 RETVAL = git_oid_to_sv(oid);
273  
274 OUTPUT: RETVAL
275  
276 SV *
277 onto_name(self)
278 Rebase self
279  
280 CODE:
281 1 const char *onto_name = git_rebase_onto_name(self);
282 1 ▶ if (onto_name == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if (onto_name == NULL) 0 1 1
283 0 XSRETURN_UNDEF;
284  
285 1 RETVAL = newSVpv (onto_name, 0);
286  
287 OUTPUT: RETVAL
288  
289 SV *
290 onto_id(self)
291 Rebase self
292  
293 CODE:
294 1 const git_oid *oid = git_rebase_onto_id(self);
295 1 ▶ if (oid == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if (oid == NULL) 0 1 1
296 0 XSRETURN_UNDEF;
297  
298 1 RETVAL = git_oid_to_sv(oid);
299  
300 OUTPUT: RETVAL
301  
302 void
303 DESTROY(self)
304 SV *self
305  
306 CODE:
307 4 git_rebase_free(GIT_SV_TO_PTR(Rebase, self));
308 4 SvREFCNT_dec(GIT_SV_TO_MAGIC(self));
« xs/Diff.xs ↑ Summary xs/PathSpec.xs »