Branch Coverage

deps/libgit2/src/sortedcache.c
Criterion Covered Total %
branch 26 86 30.2


line true false branch
21 86 0 pathlen = path ? strlen(path) : 0;
23 0 86 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_sortedcache), pathlen);
0 86 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_sortedcache), pathlen);
24 0 86 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
0 86 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
26 0 86 GIT_ERROR_CHECK_ALLOC(sc);
29 86 0 git_vector_init(&sc->items, 4, item_cmp) < 0 ||
42 86 0 if (pathlen)
70 0 415 if (sc->free_item) {
74 0 0 git_vector_foreach(&sc->items, i, item) {
87 0 81 if (git_sortedcache_wlock(sc) < 0)
102 0 81 if (!sc)
104 81 0 GIT_REFCOUNT_DEC(sc, sortedcache_free);
81 0 GIT_REFCOUNT_DEC(sc, sortedcache_free);
129 32 0 if (!copy_item) {
134 0 32 if ((error = git_sortedcache_new(
140 32 0 if (lock && git_sortedcache_rlock(src) < 0) {
0 32 if (lock && git_sortedcache_rlock(src) < 0) {
145 0 32 git_vector_foreach(&src->items, i, src_item) {
148 0 0 if ((error = git_sortedcache_upsert(&tgt_item, tgt, path)) < 0 ||
0 0 if ((error = git_sortedcache_upsert(&tgt_item, tgt, path)) < 0 ||
153 32 0 if (lock)
155 0 32 if (error)
158 32 0 *out = !error ? tgt : NULL;
209 0 334 if ((error = git_sortedcache_wlock(sc)) < 0)
212 334 0 if ((error = git_futils_filestamp_check(&sc->stamp, sc->path)) <= 0)
215 0 0 if ((fd = git_futils_open_ro(sc->path)) < 0) {
220 0 0 if (p_fstat(fd, &st) < 0) {
227 0 0 if (!git__is_sizet(st.st_size)) {
234 0 0 if (buf)
239 0 0 if (error < 0)
258 334 0 if (wlock && git_sortedcache_wlock(sc) < 0)
0 334 if (wlock && git_sortedcache_wlock(sc) < 0)
263 334 0 if (wlock)
277 0 0 if ((item = git_strmap_get(sc->map, key)) != NULL)
284 0 0 if ((item = git_pool_mallocz(&sc->pool, itemlen)) == NULL) {
297 0 0 if ((error = git_strmap_set(sc->map, item_key, item)) < 0)
300 0 0 if ((error = git_vector_insert(&sc->items, item)) < 0)
304 0 0 if (out)
305 0 0 *out = !error ? item : NULL;
325 0 0 if (!git_vector_is_sorted(&sc->items))
366 0 0 if ((item = git_vector_get(&sc->items, pos)) == NULL) {
375 0 0 if (sc->free_item)