Branch Coverage

deps/libgit2/src/libgit2/mwindow.c
Criterion Covered Total %
branch 49 138 35.5


line true false branch
55 0 87 GIT_ASSERT(!git__pack_cache);
57 87 0 if ((error = git_mutex_init(&git__mwindow_mutex)) < 0 ||
0 87 if ((error = git_mutex_init(&git__mwindow_mutex)) < 0 ||
70 0 4 if ((error = git_packfile__name(&packname, path)) < 0)
73 0 4 if (git_mutex_lock(&git__mwindow_mutex) < 0) {
81 0 4 if (pack != NULL) {
89 0 4 if ((error = git_packfile_alloc(&pack, path)) < 0) {
98 0 4 if (error < 0) {
112 0 3 if ((error = git_mutex_lock(&git__mwindow_mutex)) < 0)
116 0 3 GIT_ASSERT(git__pack_cache);
119 0 3 GIT_ASSERT(git_strmap_exists(git__pack_cache, pack->pack_name));
122 3 0 if (count == 0) {
144 8 91 for (i = 0; i < ctl->windowfiles.length; ++i){
145 8 0 if (git_vector_get(&ctl->windowfiles, i) == mwf) {
151 99 0 if (ctl->windowfiles.length == 0) {
156 48 99 while (mwf->windows) {
158 0 48 GIT_ASSERT(w->inuse_cnt == 0);
176 0 99 if (git_mutex_lock(&git__mwindow_mutex)) {
198 106 0 && (offset + extra) <= (off64_t)(win_off + win->window_map.len);
106 0 && (offset + extra) <= (off64_t)(win_off + win->window_map.len);
223 0 0 GIT_ASSERT_ARG(mwf);
224 0 0 GIT_ASSERT_ARG(out_window);
227 0 0 if (out_last)
230 0 0 for (w_last = NULL, w = mwf->windows; w; w_last = w, w = w->next) {
231 0 0 if (w->inuse_cnt) {
232 0 0 if (only_unused)
243 0 0 if (!lru_window || (comparison_sign * w->last_used) > lru_window->last_used) {
0 0 if (!lru_window || (comparison_sign * w->last_used) > lru_window->last_used) {
250 0 0 if (!found)
254 0 0 if (out_last)
270 0 0 git_vector_foreach(&ctl->windowfiles, i, cur) {
271 0 0 if (git_mwindow_scan_recently_used(
277 0 0 if (!lru_window) {
285 0 0 if (lru_last)
310 0 0 git_vector_foreach(&ctl->windowfiles, i, current_file) {
312 0 0 if (!git_mwindow_scan_recently_used(
316 0 0 if (!lru_window || lru_window->last_used > mru_window->last_used) {
0 0 if (!lru_window || lru_window->last_used > mru_window->last_used) {
322 0 0 if (!lru_file) {
344 0 48 if (w == NULL)
350 0 48 if (len > (off64_t)git_mwindow__window_size)
364 0 48 if (git_futils_mmap_ro(&w->window_map, fd, w->offset, (size_t)len) < 0) {
370 0 0 while (git_mwindow_close_lru_window_locked() == 0)
373 0 0 if (git_futils_mmap_ro(&w->window_map, fd, w->offset, (size_t)len) < 0) {
382 23 25 if (ctl->mapped > ctl->peak_mapped)
385 3 45 if (ctl->open_windows > ctl->peak_open_windows)
405 0 154 if (git_mutex_lock(&git__mwindow_mutex)) {
410 0 154 if (!w || !(git_mwindow_contains(w, offset, extra))) {
0 0 if (!w || !(git_mwindow_contains(w, offset, extra))) {
411 0 154 if (w) {
415 106 48 for (w = mwf->windows; w; w = w->next) {
416 106 0 if (git_mwindow_contains(w, offset, extra))
424 48 106 if (!w) {
426 0 48 if (w == NULL) {
436 154 0 if (w != *cursor) {
444 154 0 if (left)
459 0 8 if (git_mutex_lock(&git__mwindow_mutex)) {
464 8 0 if (ctl->windowfiles.length == 0 &&
0 8 if (ctl->windowfiles.length == 0 &&
470 0 8 if (git_mwindow__file_limit) {
474 0 0 if ((error = git_vector_insert(&closed_files, lru_file)) < 0) {
487 0 8 if (error < 0)
495 0 8 git_vector_foreach(&closed_files, i, closed_file) {
497 0 0 if (error < 0)
515 0 0 if (git_mutex_lock(&git__mwindow_mutex))
518 0 0 git_vector_foreach(&ctl->windowfiles, i, cur) {
519 0 0 if (cur == mwf) {
531 154 50 if (w) {
532 0 154 if (git_mutex_lock(&git__mwindow_mutex)) {