Branch Coverage

deps/libgit2/src/object.c
Criterion Covered Total %
branch 74 174 42.5


line true false branch
70 0 0 assert(object_out);
74 0 0 if (type != GIT_OBJECT_BLOB && type != GIT_OBJECT_TREE && type != GIT_OBJECT_COMMIT && type != GIT_OBJECT_TAG) {
0 0 if (type != GIT_OBJECT_BLOB && type != GIT_OBJECT_TREE && type != GIT_OBJECT_COMMIT && type != GIT_OBJECT_TAG) {
0 0 if (type != GIT_OBJECT_BLOB && type != GIT_OBJECT_TREE && type != GIT_OBJECT_COMMIT && type != GIT_OBJECT_TAG) {
0 0 if (type != GIT_OBJECT_BLOB && type != GIT_OBJECT_TREE && type != GIT_OBJECT_COMMIT && type != GIT_OBJECT_TAG) {
79 0 0 if ((object_size = git_object__size(type)) == 0) {
86 0 0 GIT_ERROR_CHECK_ALLOC(object);
93 0 0 assert(def->free && def->parse_raw);
0 0 assert(def->free && def->parse_raw);
95 0 0 if ((error = def->parse_raw(object, data, size)) < 0) {
117 0 367 assert(object_out);
121 311 56 if (type != GIT_OBJECT_ANY && type != odb_obj->cached.type) {
0 311 if (type != GIT_OBJECT_ANY && type != odb_obj->cached.type) {
127 0 367 if ((object_size = git_object__size(odb_obj->cached.type)) == 0) {
134 0 367 GIT_ERROR_CHECK_ALLOC(object);
143 367 0 assert(def->free && def->parse);
0 367 assert(def->free && def->parse);
145 0 367 if ((error = def->parse(object, odb_obj)) < 0)
157 360 0 if (type < 0 || ((size_t)type) >= ARRAY_SIZE(git_objects_table) ||
360 0 if (type < 0 || ((size_t)type) >= ARRAY_SIZE(git_objects_table) ||
0 360 if (type < 0 || ((size_t)type) >= ARRAY_SIZE(git_objects_table) ||
176 1680 0 assert(repo && object_out && id);
1680 0 assert(repo && object_out && id);
0 1680 assert(repo && object_out && id);
178 0 1680 if (len < GIT_OID_MINPREFIXLEN) {
184 0 1680 if (error < 0)
187 0 1680 if (len > GIT_OID_HEXSZ)
190 1666 14 if (len == GIT_OID_HEXSZ) {
197 1309 357 if (cached != NULL) {
198 1304 5 if (cached->flags == GIT_CACHE_STORE_PARSED) {
201 946 358 if (type != GIT_OBJECT_ANY && type != object->cached.type) {
0 946 if (type != GIT_OBJECT_ANY && type != object->cached.type) {
210 5 0 } else if (cached->flags == GIT_CACHE_STORE_RAW) {
241 9 367 if (error < 0)
257 4690 2693 if (object == NULL)
265 0 938 assert(obj);
271 0 1048 assert(obj);
277 0 586 assert(obj);
283 1351 0 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
0 1351 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
291 0 0 if (!str)
301 1128 0 if (!str || !len || !*str)
1128 0 if (!str || !len || !*str)
0 1128 if (!str || !len || !*str)
304 3492 0 for (i = 0; i < ARRAY_SIZE(git_objects_table); i++)
314 2195 0 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
0 2195 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
322 367 0 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
0 367 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
366 108 170 if (type == target)
377 0 170 if (target != GIT_OBJECT_TREE && target != GIT_OBJECT_ANY)
0 0 if (target != GIT_OBJECT_TREE && target != GIT_OBJECT_ANY)
398 278 0 assert(object && peeled);
0 278 assert(object && peeled);
400 278 0 assert(target_type == GIT_OBJECT_TAG ||
177 101 assert(target_type == GIT_OBJECT_TAG ||
0 177 assert(target_type == GIT_OBJECT_TAG ||
0 0 assert(target_type == GIT_OBJECT_TAG ||
0 0 assert(target_type == GIT_OBJECT_TAG ||
406 0 278 if ((error = check_type_combination(git_object_type(object), target_type)) < 0)
409 108 170 if (git_object_type(object) == target_type)
414 170 0 while (!(error = dereference_object(&deref, source))) {
416 0 170 if (source != object)
419 170 0 if (git_object_type(deref) == target_type) {
435 0 0 if (source != object)
440 0 0 if (error)
463 5 0 assert(out && treeish && path);
5 0 assert(out && treeish && path);
0 5 assert(out && treeish && path);
465 5 0 if ((error = git_object_peel((git_object**)&tree, treeish, GIT_OBJECT_TREE)) < 0 ||
4 1 if ((error = git_object_peel((git_object**)&tree, treeish, GIT_OBJECT_TREE)) < 0 ||
471 4 0 if (type != GIT_OBJECT_ANY && git_tree_entry_type(entry) != type)
0 4 if (type != GIT_OBJECT_ANY && git_tree_entry_type(entry) != type)
495 0 0 assert(out && obj);
0 0 assert(out && obj);
500 0 0 if ((error = git_repository__configmap_lookup(&len, repo, GIT_CONFIGMAP_ABBREV)) < 0)
503 0 0 if ((error = git_repository_odb(&odb, repo)) < 0)
506 0 0 while (len < GIT_OID_HEXSZ) {
509 0 0 if (len & 1)
513 0 0 if (error != GIT_EAMBIGUOUS)
520 0 0 if (!error && !(error = git_buf_grow(out, len + 1))) {
0 0 if (!error && !(error = git_buf_grow(out, len + 1))) {
538 0 327 if (!git_object__strict_input_validation)
541 327 0 if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
0 327 if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
545 251 76 if (expected_type != GIT_OBJECT_ANY && expected_type != actual_type) {
0 251 if (expected_type != GIT_OBJECT_ANY && expected_type != actual_type) {