Branch Coverage

deps/libgit2/src/libgit2/cache.c
Criterion Covered Total %
branch 34 60 56.6


line true false branch
35 0 0 if (type < 0 || (size_t)type >= ARRAY_SIZE(git_cache__max_object_size)) {
0 0 if (type < 0 || (size_t)type >= ARRAY_SIZE(git_cache__max_object_size)) {
48 0 99 if ((git_oidmap_new(&cache->map)) < 0)
51 0 99 if (git_rwlock_init(&cache->lock)) {
64 132 30 if (git_cache_size(cache) == 0)
67 258 30 git_oidmap_foreach_value(cache->map, evict, {
78 0 162 if (git_rwlock_wrlock(&cache->lock) < 0)
100 0 0 if (evict_count < 8)
104 0 0 if (evict_count > git_cache_size(cache)) {
110 0 0 while (evict_count > 0) {
114 0 0 if (git_oidmap_iterate((void **) &evict, cache->map, &i, &key) == GIT_ITEROVER)
130 1155 0 return git_cache__enabled && object_size < max_size;
678 477 return git_cache__enabled && object_size < max_size;
137 2840 0 if (!git_cache__enabled || git_rwlock_rdlock(&cache->lock) < 0)
0 2840 if (!git_cache__enabled || git_rwlock_rdlock(&cache->lock) < 0)
140 1671 1169 if ((entry = git_oidmap_get(cache->map, oid)) != NULL) {
141 362 1309 if (flags && entry->flags != flags) {
359 3 if (flags && entry->flags != flags) {
159 0 1155 if (!git_cache__enabled && cache->used_memory > 0) {
0 0 if (!git_cache__enabled && cache->used_memory > 0) {
164 477 678 if (!cache_should_store(entry->type, entry->size))
167 0 678 if (git_rwlock_wrlock(&cache->lock) < 0)
171 0 678 if (git_atomic_ssize_get(&git_cache__current_storage) > git_cache__max_storage)
175 258 420 if ((stored_entry = git_oidmap_get(cache->map, &entry->oid)) == NULL) {
176 258 0 if (git_oidmap_set(cache->map, &entry->oid, entry) == 0) {
184 7 413 if (stored_entry->flags == entry->flags) {
188 182 231 } else if (stored_entry->flags == GIT_CACHE_STORE_RAW &&
182 0 } else if (stored_entry->flags == GIT_CACHE_STORE_RAW &&
190 182 0 if (git_oidmap_set(cache->map, &entry->oid, entry) == 0) {
238 1146 3079 if (git_atomic32_dec(&obj->refcount) == 0) {