Branch Coverage

deps/libgit2/src/libgit2/odb_pack.c
Criterion Covered Total %
branch 52 198 26.2


line true false branch
217 0 0 if (st)
225 0 0 if (a->mtime < b->mtime)
227 0 0 else if (a->mtime == b->mtime)
243 4 0 if (cmp_len <= strlen(".idx") || git__suffixcmp(path_str, ".idx") != 0)
2 2 if (cmp_len <= strlen(".idx") || git__suffixcmp(path_str, ".idx") != 0)
249 0 2 if (git_vector_search2(NULL, &backend->midx_packs, packfile_byname_search_cmp, &index_prefix) == 0)
251 0 2 if (git_vector_search2(NULL, &backend->packs, packfile_byname_search_cmp, &index_prefix) == 0)
257 0 2 if (error == GIT_ENOTFOUND) {
262 2 0 if (!error)
276 0 0 git_midx_entry_find(&midx_entry, backend->midx, oid, GIT_OID_HEXSZ) == 0 &&
288 3 1583 git_vector_foreach(&backend->packs, i, p) {
289 0 3 if (p == last_found)
292 3 0 if (git_pack_entry_find(e, p, oid, GIT_OID_HEXSZ) == 0) {
315 0 24 if (backend->midx) {
317 0 0 if (error == GIT_EAMBIGUOUS)
319 0 0 if (!error && midx_entry.pack_index < git_vector_length(&backend->midx_packs)) {
0 0 if (!error && midx_entry.pack_index < git_vector_length(&backend->midx_packs)) {
328 0 24 if (last_found) {
330 0 0 if (error == GIT_EAMBIGUOUS)
332 0 0 if (!error) {
333 0 0 if (found && git_oid_cmp(&e->sha1, &found_full_oid))
0 0 if (found && git_oid_cmp(&e->sha1, &found_full_oid))
340 0 24 git_vector_foreach(&backend->packs, i, p) {
341 0 0 if (p == last_found)
345 0 0 if (error == GIT_EAMBIGUOUS)
347 0 0 if (!error) {
348 0 0 if (found && git_oid_cmp(&e->sha1, &found_full_oid))
0 0 if (found && git_oid_cmp(&e->sha1, &found_full_oid))
356 24 0 if (!found)
381 0 0 if (error < 0)
384 0 0 git_vector_foreach(&backend->midx_packs, i, p)
410 0 0 if (error < 0)
414 0 0 if (git_str_len(&pack_path) <= strlen(".idx") || git__suffixcmp(git_str_cstr(&pack_path), ".idx") != 0)
0 0 if (git_str_len(&pack_path) <= strlen(".idx") || git__suffixcmp(git_str_cstr(&pack_path), ".idx") != 0)
419 0 0 if (git_vector_search2(&found_position, &backend->packs, packfile_byname_search_cmp, &index_prefix) == 0) {
430 0 0 if (error < 0)
450 0 213 if (error < 0)
459 0 213 if (backend->midx) {
460 0 0 if (!git_midx_needs_refresh(backend->midx, git_str_cstr(&midx_path))) {
465 0 0 if (error < 0) {
473 213 0 if (error < 0)
478 0 0 git_vector_foreach(&backend->midx->packfile_names, i, packfile_name) {
480 0 0 if (error < 0) {
511 0 213 if (backend->pack_folder == NULL)
514 213 0 if (p_stat(backend->pack_folder, &st) < 0 || !S_ISDIR(st.st_mode))
0 213 if (p_stat(backend->pack_folder, &st) < 0 || !S_ISDIR(st.st_mode))
517 213 0 if (refresh_multi_pack_index(backend) < 0) {
542 0 373 GIT_ASSERT_ARG(len_p);
543 0 373 GIT_ASSERT_ARG(type_p);
544 0 373 GIT_ASSERT_ARG(backend);
545 0 373 GIT_ASSERT_ARG(oid);
547 371 2 if ((error = pack_entry_find(&e, (struct pack_backend *)backend, oid)) < 0)
560 452 0 if ((error = pack_entry_find(&e, (struct pack_backend *)backend, oid)) < 0)
565 0 0 if (e.p->last_freshen > now - FRESHEN_FREQUENCY)
568 0 0 if ((error = git_futils_touch(e.p->pack_name, &now)) < 0)
583 1 756 if ((error = pack_entry_find(&e, (struct pack_backend *)backend, oid)) < 0 ||
0 1 if ((error = pack_entry_find(&e, (struct pack_backend *)backend, oid)) < 0 ||
605 0 146 if (len < GIT_OID_MINPREFIXLEN)
608 122 24 else if (len >= GIT_OID_HEXSZ) {
611 0 122 if (!error)
617 0 24 if ((error = pack_entry_find_prefix(
618 0 0 &e, (struct pack_backend *)backend, short_oid, len)) == 0 &&
656 0 1 GIT_ASSERT_ARG(_backend);
657 0 1 GIT_ASSERT_ARG(cb);
662 0 1 if ((error = pack_backend__refresh(_backend)) != 0)
665 0 1 if (backend->midx && (error = git_midx_foreach_entry(backend->midx, cb, data)) != 0)
0 0 if (backend->midx && (error = git_midx_foreach_entry(backend->midx, cb, data)) != 0)
667 0 1 git_vector_foreach(&backend->packs, i, p) {
668 0 0 if ((error = git_pack_foreach_entry(p, cb, data)) != 0)
679 0 0 GIT_ASSERT_ARG(writepack);
688 0 0 GIT_ASSERT_ARG(writepack);
697 0 0 if (!_writepack)
716 0 0 GIT_ASSERT_ARG(out);
717 0 0 GIT_ASSERT_ARG(_backend);
727 0 0 GIT_ERROR_CHECK_ALLOC(writepack);
729 0 0 if (git_indexer_new(&writepack->indexer,
754 0 0 if (error < 0)
757 0 0 if (path_len <= strlen(".pack") || git__suffixcmp(git_str_cstr(idx_path), ".pack") != 0)
0 0 if (path_len <= strlen(".pack") || git__suffixcmp(git_str_cstr(idx_path), ".pack") != 0)
761 0 0 if (error < 0)
775 0 0 GIT_ASSERT_ARG(_backend);
780 0 0 if (error < 0)
783 0 0 git_vector_foreach(&backend->midx_packs, i, p) {
786 0 0 if (error < 0)
790 0 0 if (error < 0)
793 0 0 git_vector_foreach(&backend->packs, i, p) {
796 0 0 if (error < 0)
800 0 0 if (error < 0)
808 0 0 if (error < 0)
811 0 0 if (error < 0)
826 0 37 if (!_backend)
831 0 37 git_vector_foreach(&backend->midx_packs, i, p)
833 3 37 git_vector_foreach(&backend->packs, i, p)
846 0 38 GIT_ERROR_CHECK_ALLOC(backend);
848 0 38 if (git_vector_init(&backend->midx_packs, 0, NULL) < 0) {
852 0 38 if (git_vector_init(&backend->packs, initial_size, packfile_sort__cb) < 0) {
881 0 2 if (pack_backend__alloc(&backend, 1) < 0)
901 0 36 if (pack_backend__alloc(&backend, 8) < 0)
911 0 36 if (error < 0) {