Branch Coverage

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


line true false branch
20 0 7070 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 2502 if (attr_cache_lock(cache) < 0)
113 2401 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 3813 723 if (base != NULL && git_path_root(filename) < 0) {
3813 0 if (base != NULL && git_path_root(filename) < 0) {
170 680 3133 git_buf *p = attr_session ? &attr_session->tmp : &path;
172 0 3813 if (git_buf_joinpath(p, base, filename) < 0)
179 4536 0 if (wd && !git__prefixcmp(relfile, wd))
3801 735 if (wd && !git__prefixcmp(relfile, wd))
183 0 4536 if ((error = attr_cache_lock(cache)) < 0)
187 101 4435 if (!entry)
189 3127 1308 else if (entry->file[source] != NULL) {
219 0 4536 if ((error = attr_cache_lookup(
224 3127 1409 if (!file || (error = git_attr_file__out_of_date(repo, attr_session, file)) > 0)
2401 726 if (!file || (error = git_attr_file__out_of_date(repo, attr_session, file)) > 0)
228 2502 2034 if (updated) {
229 0 2502 if ((error = attr_cache_upsert(cache, updated)) < 0)
238 1308 3228 if (error < 0) {
240 0 1308 if (file) {
246 1308 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 909 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 ||
394 16 0 (ret = git_strmap_new(&cache->macros)) < 0 ||
399 0 16 if (cache)
420 61 0 if (repo && (cache = git__swap(repo->attrcache, NULL)) != NULL)
16 45 if (repo && (cache = git__swap(repo->attrcache, NULL)) != NULL)
441 0 16 if (macro->assigns.length == 0) {
446 0 16 if ((error = attr_cache_lock(cache)) < 0)
450 0 16 if ((preexisting = git_strmap_get(cache->macros, macro->match.pattern)) != NULL)
453 0 16 if ((error = git_strmap_set(cache->macros, macro->match.pattern, macro)) < 0)
457 16 0 if (locked)