| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | MODULE = Git::Raw			PACKAGE = Git::Raw::Tree | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | SV * | 
| 4 |  |  |  |  |  |  | lookup(class, repo, id) | 
| 5 |  |  |  |  |  |  | SV *class | 
| 6 |  |  |  |  |  |  | SV *repo | 
| 7 |  |  |  |  |  |  | SV *id | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | PREINIT: | 
| 10 |  |  |  |  |  |  | int rc; | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | Tree tree; | 
| 13 |  |  |  |  |  |  | git_oid oid; | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | STRLEN len; | 
| 16 |  |  |  |  |  |  | const char *id_str; | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | Repository repo_ptr; | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | INIT: | 
| 21 | 3 |  |  |  |  |  | len = 0; | 
| 22 | 3 |  |  |  |  |  | id_str = git_ensure_pv_with_len(id, "id", &len); | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | CODE: | 
| 25 | 3 |  |  |  |  |  | rc = git_oid_fromstrn(&oid, id_str, len); | 
| 26 | 3 |  |  |  |  |  | git_check_error(rc); | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 3 |  |  |  |  |  | repo_ptr = GIT_SV_TO_PTR(Repository, repo); | 
| 29 |  |  |  |  |  |  |  | 
| 30 | 3 |  |  |  |  |  | rc = git_tree_lookup_prefix(&tree, repo_ptr -> repository, &oid, len); | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 3 | 100 |  |  |  |  | if (rc == GIT_ENOTFOUND) { | 
| 33 | 1 |  |  |  |  |  | RETVAL = &PL_sv_undef; | 
| 34 |  |  |  |  |  |  | } else { | 
| 35 | 2 |  |  |  |  |  | git_check_error(rc); | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 2 | 50 |  |  |  |  | GIT_NEW_OBJ_WITH_MAGIC( | 
| 38 |  |  |  |  |  |  | RETVAL, SvPVbyte_nolen(class), tree, SvRV(repo) | 
| 39 |  |  |  |  |  |  | ); | 
| 40 |  |  |  |  |  |  | } | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | OUTPUT: RETVAL | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | SV * | 
| 45 |  |  |  |  |  |  | owner(self) | 
| 46 |  |  |  |  |  |  | SV *self | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | PREINIT: | 
| 49 |  |  |  |  |  |  | SV *repo; | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | CODE: | 
| 52 | 1 |  |  |  |  |  | repo = GIT_SV_TO_MAGIC(self); | 
| 53 | 1 |  |  |  |  |  | RETVAL = newRV_inc(repo); | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | OUTPUT: RETVAL | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | SV * | 
| 58 |  |  |  |  |  |  | id(self) | 
| 59 |  |  |  |  |  |  | Tree self | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | CODE: | 
| 62 | 27 |  |  |  |  |  | RETVAL = git_oid_to_sv(git_tree_id(self)); | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | OUTPUT: RETVAL | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | void | 
| 67 |  |  |  |  |  |  | entries(self) | 
| 68 |  |  |  |  |  |  | SV *self | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | PREINIT: | 
| 71 |  |  |  |  |  |  | int ctx; | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | Tree self_ptr; | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | PPCODE: | 
| 76 | 12 | 50 |  |  |  |  | ctx = GIMME_V; | 
| 77 |  |  |  |  |  |  |  | 
| 78 | 12 | 100 |  |  |  |  | if (ctx != G_VOID) { | 
| 79 |  |  |  |  |  |  | int rc, count; | 
| 80 |  |  |  |  |  |  |  | 
| 81 | 11 |  |  |  |  |  | self_ptr = GIT_SV_TO_PTR(Tree, self); | 
| 82 | 11 |  |  |  |  |  | count = git_tree_entrycount(self_ptr); | 
| 83 |  |  |  |  |  |  |  | 
| 84 | 11 | 100 |  |  |  |  | if (ctx == G_ARRAY) { | 
| 85 |  |  |  |  |  |  | int i; | 
| 86 |  |  |  |  |  |  |  | 
| 87 | 37 | 100 |  |  |  |  | for (i = 0; i < count; i++) { | 
| 88 |  |  |  |  |  |  | SV *tmp; | 
| 89 |  |  |  |  |  |  | Tree_Entry entry; | 
| 90 |  |  |  |  |  |  |  | 
| 91 | 27 |  |  |  |  |  | Tree_Entry tmp_entry = (Tree_Entry) | 
| 92 | 27 |  |  |  |  |  | git_tree_entry_byindex(self_ptr, i); | 
| 93 |  |  |  |  |  |  |  | 
| 94 | 27 |  |  |  |  |  | rc = git_tree_entry_dup(&entry, tmp_entry); | 
| 95 | 27 |  |  |  |  |  | git_check_error(rc); | 
| 96 |  |  |  |  |  |  |  | 
| 97 | 27 |  |  |  |  |  | GIT_NEW_OBJ_WITH_MAGIC( | 
| 98 |  |  |  |  |  |  | tmp, "Git::Raw::Tree::Entry", | 
| 99 |  |  |  |  |  |  | entry, GIT_SV_TO_MAGIC(self) | 
| 100 |  |  |  |  |  |  | ); | 
| 101 | 27 | 50 |  |  |  |  | mXPUSHs(tmp); | 
| 102 |  |  |  |  |  |  | } | 
| 103 |  |  |  |  |  |  |  | 
| 104 | 10 |  |  |  |  |  | XSRETURN((int) count); | 
| 105 |  |  |  |  |  |  | } else { | 
| 106 | 1 | 50 |  |  |  |  | mXPUSHs(newSViv((int) count)); | 
| 107 | 1 |  |  |  |  |  | XSRETURN(1); | 
| 108 |  |  |  |  |  |  | } | 
| 109 |  |  |  |  |  |  | } else | 
| 110 | 1 |  |  |  |  |  | XSRETURN_EMPTY; | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | SV * | 
| 113 |  |  |  |  |  |  | entry_byname(self, name) | 
| 114 |  |  |  |  |  |  | SV *self | 
| 115 |  |  |  |  |  |  | SV *name | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | PREINIT: | 
| 118 |  |  |  |  |  |  | int rc; | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | Tree_Entry tmp_entry, entry; | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | CODE: | 
| 123 | 4 |  |  |  |  |  | tmp_entry = (Tree_Entry) git_tree_entry_byname( | 
| 124 | 2 |  |  |  |  |  | GIT_SV_TO_PTR(Tree, self), | 
| 125 |  |  |  |  |  |  | git_ensure_pv(name, "name") | 
| 126 |  |  |  |  |  |  | ); | 
| 127 |  |  |  |  |  |  |  | 
| 128 | 2 | 100 |  |  |  |  | if (!tmp_entry) { | 
| 129 | 1 |  |  |  |  |  | RETVAL = &PL_sv_undef; | 
| 130 |  |  |  |  |  |  | } else { | 
| 131 | 1 |  |  |  |  |  | rc = git_tree_entry_dup(&entry, tmp_entry); | 
| 132 | 1 |  |  |  |  |  | git_check_error(rc); | 
| 133 |  |  |  |  |  |  |  | 
| 134 | 1 |  |  |  |  |  | GIT_NEW_OBJ_WITH_MAGIC( | 
| 135 |  |  |  |  |  |  | RETVAL, "Git::Raw::Tree::Entry", | 
| 136 |  |  |  |  |  |  | entry, GIT_SV_TO_MAGIC(self) | 
| 137 |  |  |  |  |  |  | ); | 
| 138 |  |  |  |  |  |  | } | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | OUTPUT: RETVAL | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | SV * | 
| 143 |  |  |  |  |  |  | entry_bypath(self, path) | 
| 144 |  |  |  |  |  |  | SV *self | 
| 145 |  |  |  |  |  |  | SV *path | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | PREINIT: | 
| 148 |  |  |  |  |  |  | int rc; | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | Tree_Entry entry; | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | CODE: | 
| 153 | 4 |  |  |  |  |  | rc = git_tree_entry_bypath( | 
| 154 | 2 |  |  |  |  |  | &entry, GIT_SV_TO_PTR(Tree, self), | 
| 155 |  |  |  |  |  |  | git_ensure_pv(path, "path") | 
| 156 |  |  |  |  |  |  | ); | 
| 157 |  |  |  |  |  |  |  | 
| 158 | 2 | 100 |  |  |  |  | if (rc == GIT_ENOTFOUND) { | 
| 159 | 1 |  |  |  |  |  | RETVAL = &PL_sv_undef; | 
| 160 |  |  |  |  |  |  | } else { | 
| 161 | 1 |  |  |  |  |  | git_check_error(rc); | 
| 162 |  |  |  |  |  |  |  | 
| 163 | 1 |  |  |  |  |  | GIT_NEW_OBJ_WITH_MAGIC( | 
| 164 |  |  |  |  |  |  | RETVAL, "Git::Raw::Tree::Entry", entry, GIT_SV_TO_MAGIC(self) | 
| 165 |  |  |  |  |  |  | ); | 
| 166 |  |  |  |  |  |  | } | 
| 167 |  |  |  |  |  |  |  | 
| 168 |  |  |  |  |  |  | OUTPUT: RETVAL | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  | Diff | 
| 171 |  |  |  |  |  |  | diff(self, ...) | 
| 172 |  |  |  |  |  |  | Tree self | 
| 173 |  |  |  |  |  |  |  | 
| 174 |  |  |  |  |  |  | PROTOTYPE: $;$ | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | PREINIT: | 
| 177 |  |  |  |  |  |  | int rc; | 
| 178 |  |  |  |  |  |  |  | 
| 179 |  |  |  |  |  |  | Diff diff; | 
| 180 |  |  |  |  |  |  |  | 
| 181 | 5 |  |  |  |  |  | Tree tree = NULL; | 
| 182 |  |  |  |  |  |  |  | 
| 183 | 5 |  |  |  |  |  | git_diff_options diff_opts = GIT_DIFF_OPTIONS_INIT; | 
| 184 |  |  |  |  |  |  |  | 
| 185 |  |  |  |  |  |  | CODE: | 
| 186 | 5 | 50 |  |  |  |  | if (items == 2) { | 
| 187 | 5 |  |  |  |  |  | HV *opts  = git_ensure_hv(ST(1), "diff_opts"); | 
| 188 | 5 |  |  |  |  |  | git_hv_to_diff_opts(opts, &diff_opts, &tree); | 
| 189 |  |  |  |  |  |  | } | 
| 190 |  |  |  |  |  |  |  | 
| 191 | 5 | 50 |  |  |  |  | if (tree) { | 
| 192 | 5 |  |  |  |  |  | rc = git_diff_tree_to_tree( | 
| 193 |  |  |  |  |  |  | &diff, git_tree_owner(self), self, tree, &diff_opts | 
| 194 |  |  |  |  |  |  | ); | 
| 195 |  |  |  |  |  |  | } else { | 
| 196 | 0 |  |  |  |  |  | rc = git_diff_tree_to_workdir( | 
| 197 |  |  |  |  |  |  | &diff, git_tree_owner(self), self, &diff_opts | 
| 198 |  |  |  |  |  |  | ); | 
| 199 |  |  |  |  |  |  | } | 
| 200 |  |  |  |  |  |  |  | 
| 201 | 5 | 100 |  |  |  |  | if (diff_opts.pathspec.count > 0) | 
| 202 | 1 |  |  |  |  |  | Safefree(diff_opts.pathspec.strings); | 
| 203 | 5 |  |  |  |  |  | git_check_error(rc); | 
| 204 |  |  |  |  |  |  |  | 
| 205 | 5 |  |  |  |  |  | RETVAL = diff; | 
| 206 |  |  |  |  |  |  |  | 
| 207 |  |  |  |  |  |  | OUTPUT: RETVAL | 
| 208 |  |  |  |  |  |  |  | 
| 209 |  |  |  |  |  |  | SV * | 
| 210 |  |  |  |  |  |  | merge(self, ancestor_tree, their_tree, ...) | 
| 211 |  |  |  |  |  |  | SV *self | 
| 212 |  |  |  |  |  |  | SV *ancestor_tree | 
| 213 |  |  |  |  |  |  | SV *their_tree | 
| 214 |  |  |  |  |  |  |  | 
| 215 |  |  |  |  |  |  | PROTOTYPE: $$$;$ | 
| 216 |  |  |  |  |  |  | PREINIT: | 
| 217 |  |  |  |  |  |  | int rc; | 
| 218 |  |  |  |  |  |  |  | 
| 219 |  |  |  |  |  |  | SV *repo; | 
| 220 |  |  |  |  |  |  | Repository repo_ptr; | 
| 221 |  |  |  |  |  |  |  | 
| 222 | 1 |  |  |  |  |  | Tree ancestor = NULL, ours = NULL, theirs = NULL; | 
| 223 |  |  |  |  |  |  |  | 
| 224 |  |  |  |  |  |  | Index index; | 
| 225 | 1 |  |  |  |  |  | git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT; | 
| 226 |  |  |  |  |  |  |  | 
| 227 |  |  |  |  |  |  | CODE: | 
| 228 | 1 | 50 |  |  |  |  | if (items == 4) { | 
| 229 | 1 |  |  |  |  |  | HV *opts = git_ensure_hv(ST(3), "options"); | 
| 230 | 1 |  |  |  |  |  | git_hv_to_merge_opts(opts, &merge_opts); | 
| 231 |  |  |  |  |  |  | } | 
| 232 |  |  |  |  |  |  |  | 
| 233 | 1 | 50 |  |  |  |  | if (SvOK(ancestor_tree)) | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
| 234 | 1 |  |  |  |  |  | ancestor = GIT_SV_TO_PTR(Tree, ancestor_tree); | 
| 235 |  |  |  |  |  |  |  | 
| 236 | 1 | 50 |  |  |  |  | if (SvOK(their_tree)) | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
| 237 | 1 |  |  |  |  |  | theirs = GIT_SV_TO_PTR(Tree, their_tree); | 
| 238 |  |  |  |  |  |  |  | 
| 239 | 1 |  |  |  |  |  | ours = GIT_SV_TO_PTR(Tree, self); | 
| 240 |  |  |  |  |  |  |  | 
| 241 | 1 |  |  |  |  |  | repo = GIT_SV_TO_MAGIC(self); | 
| 242 | 1 | 50 |  |  |  |  | repo_ptr = INT2PTR(Repository, SvIV((SV *) repo)); | 
| 243 |  |  |  |  |  |  |  | 
| 244 | 1 |  |  |  |  |  | rc = git_merge_trees(&index, repo_ptr -> repository, | 
| 245 |  |  |  |  |  |  | ancestor, ours, theirs, &merge_opts); | 
| 246 | 1 |  |  |  |  |  | git_check_error(rc); | 
| 247 |  |  |  |  |  |  |  | 
| 248 | 1 |  |  |  |  |  | GIT_NEW_OBJ_WITH_MAGIC( | 
| 249 |  |  |  |  |  |  | RETVAL, "Git::Raw::Index", index, repo | 
| 250 |  |  |  |  |  |  | ); | 
| 251 |  |  |  |  |  |  |  | 
| 252 |  |  |  |  |  |  | OUTPUT: RETVAL | 
| 253 |  |  |  |  |  |  |  | 
| 254 |  |  |  |  |  |  | SV * | 
| 255 |  |  |  |  |  |  | is_tree(self) | 
| 256 |  |  |  |  |  |  | SV *self | 
| 257 |  |  |  |  |  |  |  | 
| 258 |  |  |  |  |  |  | CODE: | 
| 259 | 1 |  |  |  |  |  | RETVAL = newSVuv(1); | 
| 260 |  |  |  |  |  |  |  | 
| 261 |  |  |  |  |  |  | OUTPUT: RETVAL | 
| 262 |  |  |  |  |  |  |  | 
| 263 |  |  |  |  |  |  | SV * | 
| 264 |  |  |  |  |  |  | is_blob(self) | 
| 265 |  |  |  |  |  |  | SV *self | 
| 266 |  |  |  |  |  |  |  | 
| 267 |  |  |  |  |  |  | CODE: | 
| 268 | 1 |  |  |  |  |  | RETVAL = newSVuv(0); | 
| 269 |  |  |  |  |  |  |  | 
| 270 |  |  |  |  |  |  | OUTPUT: RETVAL | 
| 271 |  |  |  |  |  |  |  | 
| 272 |  |  |  |  |  |  | void | 
| 273 |  |  |  |  |  |  | DESTROY(self) | 
| 274 |  |  |  |  |  |  | SV *self | 
| 275 |  |  |  |  |  |  |  | 
| 276 |  |  |  |  |  |  | CODE: | 
| 277 | 87 |  |  |  |  |  | git_tree_free(GIT_SV_TO_PTR(Tree, self)); | 
| 278 | 87 |  |  |  |  |  | SvREFCNT_dec(GIT_SV_TO_MAGIC(self)); |