Branch Coverage

deps/libgit2/src/libgit2/attrcache.c
Criterion Covered Total %
branch 75 142 52.8


line true false branch
21 0 6874 if (git_mutex_lock(&cache->lock) < 0) {
52 101 0 if (base != NULL && git_fs_path_root(path) < 0) {
97 4 if (base != NULL && git_fs_path_root(path) < 0) {
56 97 0 if (baselen && base[baselen - 1] != '/')
0 97 if (baselen && base[baselen - 1] != '/')
61 0 101 GIT_ERROR_CHECK_ALLOC(ce);
63 97 4 if (baselen) {
66 0 97 if (base[baselen - 1] != '/')
74 0 101 if (git_path_validate_str_length(repo, &fullpath_str) < 0)
91 0 101 if ((error = git_attr_cache__alloc_file_entry(&entry, repo,
95 0 101 if ((error = git_strmap_set(cache->files, entry->path, entry)) < 0)
108 0 2426 if (attr_cache_lock(cache) < 0)
122 2325 101 if (old) {
137 0 0 if (!file)
140 0 0 if ((error = attr_cache_lock(cache)) < 0)
143 0 0 if ((entry = attr_cache_lookup_entry(cache, file->entry->path)) != NULL)
148 0 0 if (oldfile == file) {
177 3715 701 if (source->base != NULL && git_fs_path_root(source->filename) < 0) {
3715 0 if (source->base != NULL && git_fs_path_root(source->filename) < 0) {
178 680 3035 git_str *p = attr_session ? &attr_session->tmp : &path;
189 4416 0 if (wd && !git__prefixcmp(filename, wd))
3703 713 if (wd && !git__prefixcmp(filename, wd))
193 0 4416 if ((error = attr_cache_lock(cache)) < 0)
198 101 4315 if (!entry) {
200 3043 1272 } else if (entry->file[source->type] != NULL) {
228 0 4416 if ((error = attr_cache_lookup(&file, &entry, repo, attr_session, source)) < 0)
232 3043 1373 if (!file ||
2325 718 if (!file ||
239 2426 1990 if (updated) {
240 0 2426 if ((error = attr_cache_upsert(cache, updated)) < 0) {
249 1272 3144 if (error < 0) {
251 0 1272 if (file) {
257 1272 0 if (error == GIT_ENOTFOUND) {
276 0 0 if (!cache || !(files = cache->files))
0 0 if (!cache || !(files = cache->files))
279 0 0 if ((entry = git_strmap_get(files, filename)) == NULL)
282 0 0 return entry && (entry->file[source_type] != NULL);
0 0 return entry && (entry->file[source_type] != NULL);
295 0 32 if ((error = git_config__lookup_entry(&entry, cfg, key, false)) < 0)
298 0 32 if (entry) {
302 0 0 if (cfgval && cfgval[0] == '~' && cfgval[1] == '/') {
0 0 if (cfgval && cfgval[0] == '~' && cfgval[1] == '/') {
0 0 if (cfgval && cfgval[0] == '~' && cfgval[1] == '/') {
303 0 0 if (! (error = git_sysdir_expand_global_file(&buf, &cfgval[2])))
305 0 0 } else if (cfgval) {
309 0 32 else if (!git_sysdir_find_xdg_file(&buf, fallback)) {
323 0 16 if (!cache)
328 16 0 if (cache->files != NULL) {
333 101 404 git_strmap_foreach_value(cache->files, entry, {
505 101 git_strmap_foreach_value(cache->files, entry, {
101 16 git_strmap_foreach_value(cache->files, entry, {
344 16 0 if (cache->macros != NULL) {
347 16 16 git_strmap_foreach_value(cache->macros, rule, {
361 16 0 if (unlock)
374 883 16 if (cache)
378 0 16 GIT_ERROR_CHECK_ALLOC(cache);
381 0 16 if (git_mutex_init(&cache->lock) < 0) {
387 0 16 if ((ret = git_repository_config_snapshot(&cfg, repo)) < 0)
393 0 16 if (ret < 0)
398 0 16 if (ret < 0)
404 16 0 if ((ret = git_strmap_new(&cache->files)) < 0 ||
16 0 if ((ret = git_strmap_new(&cache->files)) < 0 ||
405 16 0 (ret = git_strmap_new(&cache->macros)) < 0 ||
409 0 16 if (git_atomic_compare_and_swap(&repo->attrcache, NULL, cache) != NULL)
430 63 0 if (repo && (cache = git_atomic_swap(repo->attrcache, NULL)) != NULL)
16 47 if (repo && (cache = git_atomic_swap(repo->attrcache, NULL)) != NULL)
451 0 16 if (macro->assigns.length == 0) {
456 0 16 if ((error = attr_cache_lock(cache)) < 0)
460 0 16 if ((preexisting = git_strmap_get(cache->macros, macro->match.pattern)) != NULL)
463 0 16 if ((error = git_strmap_set(cache->macros, macro->match.pattern, macro)) < 0)
467 16 0 if (locked)