Branch Coverage

deps/libgit2/src/object.c
Criterion Covered Total %
branch 74 176 42.0


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);
89 0 0 if ((error = git_odb_hash(&object->cached.oid, data, size, type)) < 0)
94 0 0 assert(def->free && def->parse_raw);
0 0 assert(def->free && def->parse_raw);
96 0 0 if ((error = def->parse_raw(object, data, size)) < 0) {
118 0 379 assert(object_out);
122 323 56 if (type != GIT_OBJECT_ANY && type != odb_obj->cached.type) {
0 323 if (type != GIT_OBJECT_ANY && type != odb_obj->cached.type) {
128 0 379 if ((object_size = git_object__size(odb_obj->cached.type)) == 0) {
135 0 379 GIT_ERROR_CHECK_ALLOC(object);
144 379 0 assert(def->free && def->parse);
0 379 assert(def->free && def->parse);
146 0 379 if ((error = def->parse(object, odb_obj)) < 0)
158 372 0 if (type < 0 || ((size_t)type) >= ARRAY_SIZE(git_objects_table) ||
372 0 if (type < 0 || ((size_t)type) >= ARRAY_SIZE(git_objects_table) ||
0 372 if (type < 0 || ((size_t)type) >= ARRAY_SIZE(git_objects_table) ||
177 1692 0 assert(repo && object_out && id);
1692 0 assert(repo && object_out && id);
0 1692 assert(repo && object_out && id);
179 0 1692 if (len < GIT_OID_MINPREFIXLEN) {
185 0 1692 if (error < 0)
188 0 1692 if (len > GIT_OID_HEXSZ)
191 1678 14 if (len == GIT_OID_HEXSZ) {
198 1309 369 if (cached != NULL) {
199 1304 5 if (cached->flags == GIT_CACHE_STORE_PARSED) {
202 946 358 if (type != GIT_OBJECT_ANY && type != object->cached.type) {
0 946 if (type != GIT_OBJECT_ANY && type != object->cached.type) {
211 5 0 } else if (cached->flags == GIT_CACHE_STORE_RAW) {
242 9 379 if (error < 0)
258 5380 2705 if (object == NULL)
266 0 938 assert(obj);
272 0 1048 assert(obj);
278 0 586 assert(obj);
284 1404 0 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
0 1404 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
292 0 0 if (!str)
302 1140 0 if (!str || !len || !*str)
1140 0 if (!str || !len || !*str)
0 1140 if (!str || !len || !*str)
305 3540 0 for (i = 0; i < ARRAY_SIZE(git_objects_table); i++)
315 2260 0 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
0 2260 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
323 379 0 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
0 379 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
367 108 170 if (type == target)
378 0 170 if (target != GIT_OBJECT_TREE && target != GIT_OBJECT_ANY)
0 0 if (target != GIT_OBJECT_TREE && target != GIT_OBJECT_ANY)
399 278 0 assert(object && peeled);
0 278 assert(object && peeled);
401 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 ||
407 0 278 if ((error = check_type_combination(git_object_type(object), target_type)) < 0)
410 108 170 if (git_object_type(object) == target_type)
415 170 0 while (!(error = dereference_object(&deref, source))) {
417 0 170 if (source != object)
420 170 0 if (git_object_type(deref) == target_type) {
436 0 0 if (source != object)
441 0 0 if (error)
464 5 0 assert(out && treeish && path);
5 0 assert(out && treeish && path);
0 5 assert(out && treeish && path);
466 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 ||
472 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)
496 0 0 assert(out && obj);
0 0 assert(out && obj);
501 0 0 if ((error = git_repository__configmap_lookup(&len, repo, GIT_CONFIGMAP_ABBREV)) < 0)
504 0 0 if ((error = git_repository_odb(&odb, repo)) < 0)
507 0 0 while (len < GIT_OID_HEXSZ) {
510 0 0 if (len & 1)
514 0 0 if (error != GIT_EAMBIGUOUS)
521 0 0 if (!error && !(error = git_buf_grow(out, len + 1))) {
0 0 if (!error && !(error = git_buf_grow(out, len + 1))) {
539 0 327 if (!git_object__strict_input_validation)
542 327 0 if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
0 327 if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
546 251 76 if (expected_type != GIT_OBJECT_ANY && expected_type != actual_type) {
0 251 if (expected_type != GIT_OBJECT_ANY && expected_type != actual_type) {