| 1 |
|
| MODULE = Git::Raw PACKAGE = Git::Raw::Blob |
| 2 |
|
| |
| 3 |
|
| SV * |
| 4 |
|
| create(class, repo, buffer) |
| 5 |
|
| SV *class |
| 6 |
|
| SV *repo |
| 7 |
|
| SV *buffer |
| 8 |
|
| |
| 9 |
|
| PREINIT: |
| 10 |
|
| int rc; |
| 11 |
|
| |
| 12 |
|
| Blob blob; |
| 13 |
|
| git_oid oid; |
| 14 |
|
| |
| 15 |
|
| STRLEN len; |
| 16 |
|
| const char *buffer_str; |
| 17 |
|
| |
| 18 |
|
| Repository repo_ptr; |
| 19 |
|
| |
| 20 |
|
| CODE: |
| 21 |
5 |
| buffer_str = git_ensure_pv_with_len(buffer, "buffer", &len); |
| 22 |
5 |
| repo_ptr = GIT_SV_TO_PTR(Repository, repo); |
| 23 |
|
| |
| 24 |
5 |
| rc = git_blob_create_frombuffer(&oid, repo_ptr -> repository, buffer_str, len); |
| 25 |
5 |
| git_check_error(rc); |
| 26 |
|
| |
| 27 |
5 |
| rc = git_blob_lookup(&blob, repo_ptr -> repository, &oid); |
| 28 |
5 |
| git_check_error(rc); |
| 29 |
|
| |
| 30 |
10 |
| GIT_NEW_OBJ_WITH_MAGIC( |
| 31 |
|
| RETVAL, SvPVbyte_nolen(class), blob, SvRV(repo) |
| 32 |
|
| ); |
| 33 |
|
| |
| 34 |
|
| OUTPUT: RETVAL |
| 35 |
|
| |
| 36 |
|
| SV * |
| 37 |
|
| lookup(class, repo, id) |
| 38 |
|
| SV *class |
| 39 |
|
| SV *repo |
| 40 |
|
| SV *id |
| 41 |
|
| |
| 42 |
|
| PREINIT: |
| 43 |
|
| int rc; |
| 44 |
|
| |
| 45 |
|
| Blob blob; |
| 46 |
|
| git_oid oid; |
| 47 |
|
| |
| 48 |
|
| STRLEN len; |
| 49 |
|
| const char *id_str; |
| 50 |
|
| |
| 51 |
|
| Repository repo_ptr; |
| 52 |
|
| |
| 53 |
|
| CODE: |
| 54 |
3 |
| id_str = git_ensure_pv_with_len(id, "id", &len); |
| 55 |
|
| |
| 56 |
3 |
| rc = git_oid_fromstrn(&oid, id_str, len); |
| 57 |
3 |
| git_check_error(rc); |
| 58 |
|
| |
| 59 |
3 |
| repo_ptr = GIT_SV_TO_PTR(Repository, repo); |
| 60 |
3 |
| rc = git_blob_lookup_prefix(&blob, repo_ptr -> repository, &oid, len); |
| 61 |
|
| |
| 62 |
3 |
▶ | if (rc == GIT_ENOTFOUND) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (rc == GIT_ENOTFOUND) { |
1 |
2 |
3 |
|
| 63 |
1 |
| RETVAL = &PL_sv_undef; |
| 64 |
|
| } else { |
| 65 |
2 |
| git_check_error(rc); |
| 66 |
|
| |
| 67 |
4 |
| GIT_NEW_OBJ_WITH_MAGIC( |
| 68 |
|
| RETVAL, SvPVbyte_nolen(class), blob, SvRV(repo) |
| 69 |
|
| ); |
| 70 |
|
| } |
| 71 |
|
| |
| 72 |
|
| OUTPUT: RETVAL |
| 73 |
|
| |
| 74 |
|
| SV * |
| 75 |
|
| owner(self) |
| 76 |
|
| SV *self |
| 77 |
|
| |
| 78 |
|
| PREINIT: |
| 79 |
|
| SV *repo; |
| 80 |
|
| |
| 81 |
|
| CODE: |
| 82 |
1 |
| repo = GIT_SV_TO_MAGIC(self); |
| 83 |
1 |
| RETVAL = newRV_inc(repo); |
| 84 |
|
| |
| 85 |
|
| OUTPUT: RETVAL |
| 86 |
|
| |
| 87 |
|
| SV * |
| 88 |
|
| content(self) |
| 89 |
|
| Blob self |
| 90 |
|
| |
| 91 |
|
| PREINIT: |
| 92 |
|
| git_off_t len; |
| 93 |
|
| |
| 94 |
|
| CODE: |
| 95 |
14 |
| len = git_blob_rawsize(self); |
| 96 |
14 |
| RETVAL = newSVpv(git_blob_rawcontent(self), (STRLEN) len); |
| 97 |
|
| |
| 98 |
|
| OUTPUT: RETVAL |
| 99 |
|
| |
| 100 |
|
| SV * |
| 101 |
|
| size(self) |
| 102 |
|
| Blob self |
| 103 |
|
| |
| 104 |
|
| CODE: |
| 105 |
6 |
| RETVAL = newSVuv(git_blob_rawsize(self)); |
| 106 |
|
| |
| 107 |
|
| OUTPUT: RETVAL |
| 108 |
|
| |
| 109 |
|
| SV * |
| 110 |
|
| id(self) |
| 111 |
|
| Blob self |
| 112 |
|
| |
| 113 |
|
| CODE: |
| 114 |
40 |
| RETVAL = git_oid_to_sv(git_blob_id(self)); |
| 115 |
|
| |
| 116 |
|
| OUTPUT: RETVAL |
| 117 |
|
| |
| 118 |
|
| SV * |
| 119 |
|
| is_tree(self) |
| 120 |
|
| SV *self |
| 121 |
|
| |
| 122 |
|
| CODE: |
| 123 |
1 |
| RETVAL = newSVuv(0); |
| 124 |
|
| |
| 125 |
|
| OUTPUT: RETVAL |
| 126 |
|
| |
| 127 |
|
| SV * |
| 128 |
|
| is_blob(self) |
| 129 |
|
| SV *self |
| 130 |
|
| |
| 131 |
|
| CODE: |
| 132 |
3 |
| RETVAL = newSVuv(1); |
| 133 |
|
| |
| 134 |
|
| OUTPUT: RETVAL |
| 135 |
|
| |
| 136 |
|
| SV * |
| 137 |
|
| is_binary(self) |
| 138 |
|
| Blob self |
| 139 |
|
| |
| 140 |
|
| CODE: |
| 141 |
1 |
| RETVAL = newSViv(git_blob_is_binary(self)); |
| 142 |
|
| |
| 143 |
|
| OUTPUT: RETVAL |
| 144 |
|
| |
| 145 |
|
| void |
| 146 |
|
| DESTROY(self) |
| 147 |
|
| SV *self |
| 148 |
|
| |
| 149 |
|
| CODE: |
| 150 |
40 |
| git_blob_free(GIT_SV_TO_PTR(Blob, self)); |
| 151 |
40 |
| SvREFCNT_dec(GIT_SV_TO_MAGIC(self)); |