Branch Coverage

deps/libgit2/src/odb_pack.c
Criterion Covered Total %
branch 45 120 37.5


line true false branch
179 0 0 if (st)
187 0 0 if (a->mtime < b->mtime)
189 0 0 else if (a->mtime == b->mtime)
204 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)
209 0 2 for (i = 0; i < backend->packs.length; ++i) {
212 0 0 if (strncmp(p->pack_name, path_str, cmp_len) == 0)
219 0 2 if (error == GIT_ENOTFOUND) {
224 2 0 if (!error)
243 3 1592 for (i = 0; i < backend->packs.length; ++i) {
247 0 3 if (p == last_found)
250 3 0 if (git_pack_entry_find(e, p, oid, GIT_OID_HEXSZ) == 0) {
267 3 1592 if (!pack_entry_find_inner(e, backend, oid, last_found))
286 0 24 if (last_found) {
288 0 0 if (error == GIT_EAMBIGUOUS)
290 0 0 if (!error) {
296 0 24 for (i = 0; i < backend->packs.length; ++i) {
300 0 0 if (p == last_found)
304 0 0 if (error == GIT_EAMBIGUOUS)
306 0 0 if (!error) {
307 0 0 if (found && git_oid_cmp(&e->sha1, &found_full_oid))
0 0 if (found && git_oid_cmp(&e->sha1, &found_full_oid))
315 24 0 if (!found)
337 0 213 if (backend->pack_folder == NULL)
340 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))
361 385 0 assert(len_p && type_p && backend && oid);
385 0 assert(len_p && type_p && backend && oid);
385 0 assert(len_p && type_p && backend && oid);
0 385 assert(len_p && type_p && backend && oid);
363 383 2 if ((error = pack_entry_find(&e, (struct pack_backend *)backend, oid)) < 0)
376 449 0 if ((error = pack_entry_find(&e, (struct pack_backend *)backend, oid)) < 0)
381 0 0 if (e.p->last_freshen > now - FRESHEN_FREQUENCY)
384 0 0 if ((error = git_futils_touch(e.p->pack_name, &now)) < 0)
399 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 ||
421 0 146 if (len < GIT_OID_MINPREFIXLEN)
424 122 24 else if (len >= GIT_OID_HEXSZ) {
427 0 122 if (!error)
433 0 24 if ((error = pack_entry_find_prefix(
434 0 0 &e, (struct pack_backend *)backend, short_oid, len)) == 0 &&
472 1 0 assert(_backend && cb);
0 1 assert(_backend && cb);
476 0 1 if ((error = pack_backend__refresh(_backend)) < 0)
479 0 1 git_vector_foreach(&backend->packs, i, p) {
480 0 0 if ((error = git_pack_foreach_entry(p, cb, data)) != 0)
491 0 0 assert(writepack);
500 0 0 assert(writepack);
509 0 0 assert(writepack);
525 0 0 assert(out && _backend);
0 0 assert(out && _backend);
535 0 0 GIT_ERROR_CHECK_ALLOC(writepack);
537 0 0 if (git_indexer_new(&writepack->indexer,
558 0 37 assert(_backend);
562 3 37 for (i = 0; i < backend->packs.length; ++i) {
575 0 38 GIT_ERROR_CHECK_ALLOC(backend);
577 0 38 if (git_vector_init(&backend->packs, initial_size, packfile_sort__cb) < 0) {
604 0 2 if (pack_backend__alloc(&backend, 1) < 0)
624 0 36 if (pack_backend__alloc(&backend, 8) < 0)
634 0 36 if (error < 0) {