Branch Coverage

deps/libgit2/src/attrcache.c
Criterion Covered Total %
branch 74 140 52.8


line true false branch
20 0 6206 if (git_mutex_lock(&cache->lock) < 0) {
49 101 0 if (base != NULL && git_path_root(path) < 0) {
97 4 if (base != NULL && git_path_root(path) < 0) {
53 97 0 if (baselen && base[baselen - 1] != '/')
0 97 if (baselen && base[baselen - 1] != '/')
58 0 101 GIT_ERROR_CHECK_ALLOC(ce);
60 97 4 if (baselen) {
63 0 97 if (base[baselen - 1] != '/')
82 0 101 if ((error = git_attr_cache__alloc_file_entry(&entry, git_repository_workdir(repo),
86 0 101 if ((error = git_strmap_set(cache->files, entry->path, entry)) < 0)
99 0 2158 if (attr_cache_lock(cache) < 0)
113 2057 101 if (old) {
128 0 0 if (!file)
131 0 0 if ((error = attr_cache_lock(cache)) < 0)
134 0 0 if ((entry = attr_cache_lookup_entry(cache, file->entry->path)) != NULL)
139 0 0 if (old) {
169 3377 639 if (base != NULL && git_path_root(filename) < 0) {
3377 0 if (base != NULL && git_path_root(filename) < 0) {
170 680 2697 git_buf *p = attr_session ? &attr_session->tmp : &path;
172 0 3377 if (git_buf_joinpath(p, base, filename) < 0)
179 4016 0 if (wd && !git__prefixcmp(relfile, wd))
3365 651 if (wd && !git__prefixcmp(relfile, wd))
183 0 4016 if ((error = attr_cache_lock(cache)) < 0)
187 101 3915 if (!entry)
189 2783 1132 else if (entry->file[source] != NULL) {
219 0 4016 if ((error = attr_cache_lookup(
224 2783 1233 if (!file || (error = git_attr_file__out_of_date(repo, attr_session, file)) > 0)
2057 726 if (!file || (error = git_attr_file__out_of_date(repo, attr_session, file)) > 0)
228 2158 1858 if (updated) {
229 0 2158 if ((error = attr_cache_upsert(cache, updated)) < 0)
238 1132 2884 if (error < 0) {
240 0 1132 if (file) {
246 1132 0 if (error == GIT_ENOTFOUND) {
265 0 0 if (!cache || !(files = cache->files))
0 0 if (!cache || !(files = cache->files))
268 0 0 if ((entry = git_strmap_get(files, filename)) == NULL)
271 0 0 return entry && (entry->file[source] != NULL);
0 0 return entry && (entry->file[source] != NULL);
284 0 32 if ((error = git_config__lookup_entry(&entry, cfg, key, false)) < 0)
287 0 32 if (entry) {
291 0 0 if (cfgval && cfgval[0] == '~' && cfgval[1] == '/') {
0 0 if (cfgval && cfgval[0] == '~' && cfgval[1] == '/') {
0 0 if (cfgval && cfgval[0] == '~' && cfgval[1] == '/') {
292 0 0 if (! (error = git_sysdir_expand_global_file(&buf, &cfgval[2])))
294 0 0 } else if (cfgval) {
298 0 32 else if (!git_sysdir_find_xdg_file(&buf, fallback)) {
312 0 16 if (!cache)
317 16 0 if (cache->files != NULL) {
322 101 303 git_strmap_foreach_value(cache->files, entry, {
404 101 git_strmap_foreach_value(cache->files, entry, {
101 16 git_strmap_foreach_value(cache->files, entry, {
333 16 0 if (cache->macros != NULL) {
336 16 16 git_strmap_foreach_value(cache->macros, rule, {
350 16 0 if (unlock)
363 825 16 if (cache)
367 0 16 GIT_ERROR_CHECK_ALLOC(cache);
370 0 16 if (git_mutex_init(&cache->lock) < 0) {
376 0 16 if ((ret = git_repository_config_snapshot(&cfg, repo)) < 0)
382 0 16 if (ret < 0)
387 0 16 if (ret < 0)
393 16 0 if ((ret = git_strmap_new(&cache->files)) < 0 ||
16 0 if ((ret = git_strmap_new(&cache->files)) < 0 ||
400 0 16 if (cache)
421 44 0 if (repo && (cache = git__swap(repo->attrcache, NULL)) != NULL)
16 28 if (repo && (cache = git__swap(repo->attrcache, NULL)) != NULL)
442 0 16 if (macro->assigns.length == 0) {
447 0 16 if ((error = attr_cache_lock(cache)) < 0)
451 0 16 if ((preexisting = git_strmap_get(cache->macros, macro->match.pattern)) != NULL)
454 0 16 if ((error = git_strmap_set(cache->macros, macro->match.pattern, macro)) < 0)
458 16 0 if (locked)