Branch Coverage

deps/libgit2/src/libgit2/ignore.c
Criterion Covered Total %
branch 91 220 41.3


line true false branch
56 0 0 if ((rule->flags & GIT_ATTR_FNMATCH_NEGATIVE) != 0
57 0 0 || (neg->flags & GIT_ATTR_FNMATCH_NEGATIVE) == 0)
60 0 0 if (neg->flags & GIT_ATTR_FNMATCH_ICASE)
66 0 0 if (rule->length == neg->length) {
68 0 0 } else if (rule->length < neg->length) {
82 0 0 if (p[-1] != '/')
84 0 0 if (memchr(shorter->pattern, '/', shorter->length) != NULL)
114 0 0 if (match->flags & GIT_ATTR_FNMATCH_ICASE)
118 0 0 if (match->containing_dir) {
121 0 0 if (git_str_puts(&buf, match->pattern) < 0)
126 0 0 git_vector_foreach(rules, i, rule) {
127 0 0 if (!(rule->flags & GIT_ATTR_FNMATCH_HASWILD)) {
128 0 0 if (does_negate_pattern(rule, match)) {
138 0 0 if (rule->containing_dir)
142 0 0 if (git_str_oom(&buf))
151 0 0 if (!(rule->flags & GIT_ATTR_FNMATCH_FULLPATH))
155 0 0 if ((wildmatch(git_str_cstr(&buf), path, effective_flags)) == WM_MATCH) {
180 0 369 if (git_repository__configmap_lookup(&ignore_case, repo, GIT_CONFIGMAP_IGNORECASE) < 0)
185 176 191 git_fs_path_root(attrs->entry->path) < 0 &&
189 0 369 if (git_mutex_lock(&attrs->lock) < 0) {
194 441 0 while (!error && *scan) {
72 369 while (!error && *scan) {
197 58 14 if (!match && !(match = git__calloc(1, sizeof(*match)))) {
0 58 if (!match && !(match = git__calloc(1, sizeof(*match)))) {
205 44 28 if (!(error = git_attr_fnmatch__parse(
210 0 44 if (ignore_case)
221 0 44 if (match->flags & GIT_ATTR_FNMATCH_NEGATIVE
222 0 0 && !(match->flags & GIT_ATTR_FNMATCH_HASWILD))
225 44 0 if (!error && valid_rule)
44 0 if (!error && valid_rule)
229 44 28 if (error != 0 || !valid_rule) {
0 44 if (error != 0 || !valid_rule) {
232 28 0 if (error == GIT_ENOTFOUND)
257 0 540 if (error < 0)
260 540 0 if (file != NULL) {
261 0 540 if ((error = git_vector_insert(which_list, file)) < 0)
280 0 184 if ((error = git_attr_cache__init(repo)) < 0)
286 184 0 if (!error && !(*out)->rules.length)
14 170 if (!error && !(*out)->rules.length)
301 0 182 GIT_ASSERT_ARG(repo);
302 0 182 GIT_ASSERT_ARG(ignores);
303 0 182 GIT_ASSERT_ARG(path);
309 0 182 if ((error = git_repository__configmap_lookup(
313 0 182 if ((error = git_attr_cache__init(repo)) < 0)
317 182 0 if (workdir && git_fs_path_root(path) < 0) {
182 0 if (workdir && git_fs_path_root(path) < 0) {
320 182 0 if ((error = git_fs_path_dirname_r(&local, path)) < 0 ||
182 0 if ((error = git_fs_path_dirname_r(&local, path)) < 0 ||
321 182 0 (error = git_fs_path_resolve_relative(&local, 0)) < 0 ||
322 182 0 (error = git_fs_path_to_dir(&local)) < 0 ||
330 0 0 if (!(error = git_str_joinpath(&ignores->dir, path, "")))
334 0 182 if (error < 0)
337 182 0 if (workdir && !git__prefixcmp(ignores->dir.ptr, workdir))
182 0 if (workdir && !git__prefixcmp(ignores->dir.ptr, workdir))
341 0 182 if ((error = get_internal_ignores(&ignores->ign_internal, repo)) < 0)
345 182 0 if (workdir != NULL) {
348 0 182 if (error < 0)
353 182 0 if ((error = git_repository__item_path(&infopath, repo, GIT_REPOSITORY_ITEM_INFO)) < 0 ||
0 182 if ((error = git_repository__item_path(&infopath, repo, GIT_REPOSITORY_ITEM_INFO)) < 0 ||
355 0 0 if (error != GIT_ENOTFOUND)
361 0 182 if (git_repository_attr_cache(repo)->cfg_excl_file != NULL)
368 0 182 if (error < 0)
376 0 176 if (git_str_joinpath(&ign->dir, ign->dir.ptr, dir) < 0)
387 355 0 if (ign->ign_path.length > 0) {
400 176 179 if ((end = strrchr(start, '/')) != NULL) {
405 176 0 if (pathlen == dirlen && !memcmp(relpath, start, dirlen)) {
176 0 if (pathlen == dirlen && !memcmp(relpath, start, dirlen)) {
412 176 179 if (--ign->depth > 0) {
427 182 213 git_vector_foreach(&ignores->ign_path, i, file) {
433 182 213 git_vector_foreach(&ignores->ign_global, i, file) {
448 2330 2666 git_vector_rforeach(&file->rules, j, match) {
449 0 2330 if (match->flags & GIT_ATTR_FNMATCH_DIRECTORY &&
0 0 if (match->flags & GIT_ATTR_FNMATCH_DIRECTORY &&
452 11 2319 if (git_attr_fnmatch__match(match, path)) {
471 0 760 if (git_attr_path__init(
476 10 750 if (ignore_lookup_in_rules(out, ignores->ign_internal, &path))
483 1160 750 git_vector_rforeach(&ignores->ign_path, i, file) {
484 0 1160 if (ignore_lookup_in_rules(out, file, &path))
489 750 750 git_vector_foreach(&ignores->ign_global, i, file) {
490 0 750 if (ignore_lookup_in_rules(out, file, &path))
504 0 2 if ((error = get_internal_ignores(&ign_internal, repo)) < 0)
518 0 0 if ((error = get_internal_ignores(&ign_internal, repo)) < 0)
521 0 0 if (!(error = git_attr_file__clear_rules(ign_internal, true)))
542 0 3 GIT_ASSERT_ARG(repo);
543 0 3 GIT_ASSERT_ARG(ignored);
544 0 3 GIT_ASSERT_ARG(pathname);
551 0 3 if (!git__suffixcmp(pathname, "/"))
553 0 3 else if (git_repository_is_bare(repo))
556 3 0 if ((error = git_attr_path__init(&path, pathname, workdir, dir_flag)) < 0 ||
3 0 if ((error = git_attr_path__init(&path, pathname, workdir, dir_flag)) < 0 ||
562 1 2 if (ignore_lookup_in_rules(ignored, ignores.ign_internal, &path))
566 2 2 git_vector_foreach(&ignores.ign_path, i, file) {
567 0 2 if (ignore_lookup_in_rules(ignored, file, &path))
572 2 2 git_vector_foreach(&ignores.ign_global, i, file) {
573 0 2 if (ignore_lookup_in_rules(ignored, file, &path))
578 2 0 if (path.basename == path.path)
581 0 0 while (path.basename > path.path && *path.basename != '/')
0 0 while (path.basename > path.path && *path.basename != '/')
583 0 0 if (path.basename > path.path)
587 0 0 if ((error = git_ignore__pop_dir(&ignores)) < 0)
612 0 0 if ((error = git_repository__ensure_not_bare(
613 0 0 repo, "validate pathspec")) < 0 ||
617 0 0 git_vector_foreach(vspec, i, match) {
619 0 0 if ((match->flags & GIT_ATTR_FNMATCH_HASWILD) != 0 &&
0 0 if ((match->flags & GIT_ATTR_FNMATCH_HASWILD) != 0 &&
626 0 0 if (git_index_get_bypath(idx, filename, 0) != NULL)
629 0 0 if ((error = git_repository_workdir_path(&path, repo, filename)) < 0)
633 0 0 if (!git_fs_path_isfile(path.ptr))
637 0 0 if ((error = git_ignore_path_is_ignored(&ignored, repo, filename)) < 0)
640 0 0 if (ignored) {