Branch Coverage

deps/libgit2/src/sortedcache.c
Criterion Covered Total %
branch 25 84 29.7


line true false branch
21 67 0 pathlen = path ? strlen(path) : 0;
23 0 67 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_sortedcache), pathlen);
0 67 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_sortedcache), pathlen);
24 0 67 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
0 67 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
26 0 67 GIT_ERROR_CHECK_ALLOC(sc);
43 67 0 if (pathlen)
71 0 418 if (sc->free_item) {
75 0 0 git_vector_foreach(&sc->items, i, item) {
88 0 64 if (git_sortedcache_wlock(sc) < 0)
103 0 64 if (!sc)
105 64 0 GIT_REFCOUNT_DEC(sc, sortedcache_free);
64 0 GIT_REFCOUNT_DEC(sc, sortedcache_free);
130 32 0 if (!copy_item) {
135 0 32 if ((error = git_sortedcache_new(
141 32 0 if (lock && git_sortedcache_rlock(src) < 0) {
0 32 if (lock && git_sortedcache_rlock(src) < 0) {
146 0 32 git_vector_foreach(&src->items, i, src_item) {
149 0 0 if ((error = git_sortedcache_upsert(&tgt_item, tgt, path)) < 0 ||
0 0 if ((error = git_sortedcache_upsert(&tgt_item, tgt, path)) < 0 ||
154 32 0 if (lock)
156 0 32 if (error)
159 32 0 *out = !error ? tgt : NULL;
210 0 354 if ((error = git_sortedcache_wlock(sc)) < 0)
213 354 0 if ((error = git_futils_filestamp_check(&sc->stamp, sc->path)) <= 0)
216 0 0 if ((fd = git_futils_open_ro(sc->path)) < 0) {
221 0 0 if (p_fstat(fd, &st) < 0) {
228 0 0 if (!git__is_sizet(st.st_size)) {
235 0 0 if (buf)
240 0 0 if (error < 0)
259 354 0 if (wlock && git_sortedcache_wlock(sc) < 0)
0 354 if (wlock && git_sortedcache_wlock(sc) < 0)
264 354 0 if (wlock)
278 0 0 if ((item = git_strmap_get(sc->map, key)) != NULL)
285 0 0 if ((item = git_pool_mallocz(&sc->pool, itemlen)) == NULL) {
298 0 0 if ((error = git_strmap_set(sc->map, item_key, item)) < 0)
301 0 0 if ((error = git_vector_insert(&sc->items, item)) < 0)
305 0 0 if (out)
306 0 0 *out = !error ? item : NULL;
326 0 0 if (!git_vector_is_sorted(&sc->items))
367 0 0 if ((item = git_vector_get(&sc->items, pos)) == NULL) {
376 0 0 if (sc->free_item)