xs/Object.xs

filter: Statementstmt 92.8% 13 / 14 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 87.5% 14 / 16 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« deps/libgit2/src/util/khash.h ↑ Summary xs/Odb/Backend/Loose.xs »
1 MODULE = Git::Raw PACKAGE = Git::Raw::Object
2  
3 INCLUDE: const-xs-object.inc
4  
5 SV *
6 id(self)
7 Object self
8  
9 CODE:
10 1 RETVAL = git_oid_to_sv(git_object_id(self));
11  
12 OUTPUT: RETVAL
13  
14 SV *
15 lookup(class, repo, id)
16 SV *class
17 SV *repo
18 SV *id
19  
20 PREINIT:
21 int rc;
22  
23 git_oid oid;
24 git_object *obj;
25  
26 STRLEN len;
27 const char *id_str;
28  
29 1 Repository repo_ptr = NULL;
30  
31 CODE:
32 1 id_str = git_ensure_pv_with_len(id, "id", &len);
33  
34 1 rc = git_oid_fromstrn(&oid, id_str, len);
35 1 git_check_error(rc);
36  
37 1 repo_ptr = GIT_SV_TO_PTR(Repository, repo);
38 1 rc = git_object_lookup_prefix(
39 &obj, repo_ptr -> repository, &oid, len, GIT_OBJ_ANY
40 );
41  
42 1 ▶ if (rc == GIT_ENOTFOUND)
Branch: 1 branch
BranchTrueFalseTotal
if (rc == GIT_ENOTFOUND) 0 1 1
43 0 XSRETURN_UNDEF;
44  
45 1 git_check_error(rc);
46 1 GIT_NEW_OBJ_WITH_MAGIC(
47 RETVAL, "Git::Raw::Object",
48 obj, repo
49 );
50  
51 OUTPUT: RETVAL
52  
53 SV *
54 type(self)
55 Object self
56  
57 CODE:
58 1 RETVAL = newSViv(git_object_type(self));
59  
60 OUTPUT: RETVAL
61  
62 void
63 DESTROY(self)
64 SV *self
65  
66 CODE:
67 1 git_object_free(GIT_SV_TO_PTR(Object, self));
68 1 SvREFCNT_dec(GIT_SV_TO_MAGIC(self));
69  
« deps/libgit2/src/util/khash.h ↑ Summary xs/Odb/Backend/Loose.xs »