Branch Coverage

deps/libgit2/src/libgit2/object.c
Criterion Covered Total %
branch 75 192 39.0


line true false branch
71 0 0 GIT_ASSERT_ARG(object_out);
75 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) {
80 0 0 if ((object_size = git_object__size(type)) == 0) {
87 0 0 GIT_ERROR_CHECK_ALLOC(object);
90 0 0 if ((error = git_odb_hash(&object->cached.oid, data, size, type)) < 0)
95 0 0 GIT_ASSERT(def->free && def->parse_raw);
0 0 GIT_ASSERT(def->free && def->parse_raw);
97 0 0 if ((error = def->parse_raw(object, data, size)) < 0) {
119 0 379 GIT_ASSERT_ARG(object_out);
123 323 56 if (type != GIT_OBJECT_ANY && type != odb_obj->cached.type) {
0 323 if (type != GIT_OBJECT_ANY && type != odb_obj->cached.type) {
129 0 379 if ((object_size = git_object__size(odb_obj->cached.type)) == 0) {
136 0 379 GIT_ERROR_CHECK_ALLOC(object);
145 379 0 GIT_ASSERT(def->free && def->parse);
0 379 GIT_ASSERT(def->free && def->parse);
147 0 379 if ((error = def->parse(object, odb_obj)) < 0) {
164 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) ||
183 0 1692 GIT_ASSERT_ARG(repo);
184 0 1692 GIT_ASSERT_ARG(object_out);
185 0 1692 GIT_ASSERT_ARG(id);
187 0 1692 if (len < GIT_OID_MINPREFIXLEN) {
193 0 1692 if (error < 0)
196 0 1692 if (len > GIT_OID_HEXSZ)
199 1678 14 if (len == GIT_OID_HEXSZ) {
206 1309 369 if (cached != NULL) {
207 1304 5 if (cached->flags == GIT_CACHE_STORE_PARSED) {
210 946 358 if (type != GIT_OBJECT_ANY && type != object->cached.type) {
0 946 if (type != GIT_OBJECT_ANY && type != object->cached.type) {
219 5 0 } else if (cached->flags == GIT_CACHE_STORE_RAW) {
250 9 379 if (error < 0)
253 0 379 GIT_ASSERT(odb_obj);
267 7649 2705 if (object == NULL)
275 0 938 GIT_ASSERT_ARG_WITH_RETVAL(obj, NULL);
281 0 1048 GIT_ASSERT_ARG_WITH_RETVAL(obj, GIT_OBJECT_INVALID);
287 0 586 GIT_ASSERT_ARG_WITH_RETVAL(obj, NULL);
293 1395 0 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
0 1395 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
301 0 0 if (!str)
311 1128 0 if (!str || !len || !*str)
1128 0 if (!str || !len || !*str)
0 1128 if (!str || !len || !*str)
314 3510 0 for (i = 0; i < ARRAY_SIZE(git_objects_table); i++)
324 2239 0 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
0 2239 if (type < 0 || ((size_t) type) >= ARRAY_SIZE(git_objects_table))
332 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))
376 108 170 if (type == target)
387 0 170 if (target != GIT_OBJECT_TREE && target != GIT_OBJECT_ANY)
0 0 if (target != GIT_OBJECT_TREE && target != GIT_OBJECT_ANY)
408 0 278 GIT_ASSERT_ARG(object);
409 0 278 GIT_ASSERT_ARG(peeled);
411 278 0 GIT_ASSERT_ARG(target_type == GIT_OBJECT_TAG ||
177 101 GIT_ASSERT_ARG(target_type == GIT_OBJECT_TAG ||
0 177 GIT_ASSERT_ARG(target_type == GIT_OBJECT_TAG ||
0 0 GIT_ASSERT_ARG(target_type == GIT_OBJECT_TAG ||
0 0 GIT_ASSERT_ARG(target_type == GIT_OBJECT_TAG ||
417 0 278 if ((error = check_type_combination(git_object_type(object), target_type)) < 0)
420 108 170 if (git_object_type(object) == target_type)
425 170 0 while (!(error = dereference_object(&deref, source))) {
427 0 170 if (source != object)
430 170 0 if (git_object_type(deref) == target_type) {
446 0 0 if (source != object)
451 0 0 if (error)
474 0 5 GIT_ASSERT_ARG(out);
475 0 5 GIT_ASSERT_ARG(treeish);
476 0 5 GIT_ASSERT_ARG(path);
478 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 ||
484 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)
508 0 0 GIT_ASSERT_ARG(out);
509 0 0 GIT_ASSERT_ARG(obj);
513 0 0 if ((error = git_repository__configmap_lookup(&len, repo, GIT_CONFIGMAP_ABBREV)) < 0)
516 0 0 if ((error = git_repository_odb(&odb, repo)) < 0)
519 0 0 while (len < GIT_OID_HEXSZ) {
522 0 0 if (len & 1)
526 0 0 if (error != GIT_EAMBIGUOUS)
533 0 0 if (!error && !(error = git_str_grow(out, len + 1))) {
0 0 if (!error && !(error = git_str_grow(out, len + 1))) {
545 0 0 GIT_BUF_WRAP_PRIVATE(out, git_object__short_id, obj);
0 0 GIT_BUF_WRAP_PRIVATE(out, git_object__short_id, obj);
556 0 315 if (!git_object__strict_input_validation)
559 315 0 if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
0 315 if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
563 239 76 if (expected_type != GIT_OBJECT_ANY && expected_type != actual_type) {
0 239 if (expected_type != GIT_OBJECT_ANY && expected_type != actual_type) {
581 0 0 GIT_ASSERT_ARG(valid);
582 0 0 GIT_ASSERT_ARG(buf);
585 0 0 if (type == GIT_OBJECT_BLOB) {
593 0 0 if (error == 0) {
596 0 0 } else if (error == GIT_EINVALID) {