Branch Coverage

deps/libgit2/src/ignore.c
Criterion Covered Total %
branch 90 214 42.0


line true false branch
55 0 0 if ((rule->flags & GIT_ATTR_FNMATCH_NEGATIVE) != 0
56 0 0 || (neg->flags & GIT_ATTR_FNMATCH_NEGATIVE) == 0)
59 0 0 if (neg->flags & GIT_ATTR_FNMATCH_ICASE)
65 0 0 if (rule->length == neg->length) {
67 0 0 } else if (rule->length < neg->length) {
81 0 0 if (p[-1] != '/')
83 0 0 if (memchr(shorter->pattern, '/', shorter->length) != NULL)
113 0 0 if (match->flags & GIT_ATTR_FNMATCH_ICASE)
117 0 0 if (match->containing_dir) {
120 0 0 if (git_buf_puts(&buf, match->pattern) < 0)
125 0 0 git_vector_foreach(rules, i, rule) {
126 0 0 if (!(rule->flags & GIT_ATTR_FNMATCH_HASWILD)) {
127 0 0 if (does_negate_pattern(rule, match)) {
137 0 0 if (rule->containing_dir)
141 0 0 if (git_buf_oom(&buf))
145 0 0 if ((wildmatch(git_buf_cstr(&buf), path, wildmatch_flags)) == WM_MATCH) {
170 0 373 if (git_repository__configmap_lookup(&ignore_case, repo, GIT_CONFIGMAP_IGNORECASE) < 0)
175 176 195 git_path_root(attrs->entry->path) < 0 &&
179 0 373 if (git_mutex_lock(&attrs->lock) < 0) {
184 445 0 while (!error && *scan) {
72 373 while (!error && *scan) {
187 58 14 if (!match && !(match = git__calloc(1, sizeof(*match)))) {
0 58 if (!match && !(match = git__calloc(1, sizeof(*match)))) {
195 44 28 if (!(error = git_attr_fnmatch__parse(
200 0 44 if (ignore_case)
211 0 44 if (match->flags & GIT_ATTR_FNMATCH_NEGATIVE
212 0 0 && !(match->flags & GIT_ATTR_FNMATCH_HASWILD))
215 44 0 if (!error && valid_rule)
44 0 if (!error && valid_rule)
219 44 28 if (error != 0 || !valid_rule) {
0 44 if (error != 0 || !valid_rule) {
222 28 0 if (error == GIT_ENOTFOUND)
246 0 548 if (error < 0)
249 548 0 if (file != NULL) {
250 0 548 if ((error = git_vector_insert(which_list, file)) < 0)
268 0 188 if ((error = git_attr_cache__init(repo)) < 0)
275 188 0 if (!error && !(*out)->rules.length)
14 174 if (!error && !(*out)->rules.length)
290 186 0 assert(repo && ignores && path);
186 0 assert(repo && ignores && path);
0 186 assert(repo && ignores && path);
296 0 186 if ((error = git_repository__configmap_lookup(
300 0 186 if ((error = git_attr_cache__init(repo)) < 0)
304 186 0 if (workdir && git_path_root(path) < 0) {
186 0 if (workdir && git_path_root(path) < 0) {
307 186 0 if ((error = git_path_dirname_r(&local, path)) < 0 ||
186 0 if ((error = git_path_dirname_r(&local, path)) < 0 ||
308 186 0 (error = git_path_resolve_relative(&local, 0)) < 0 ||
316 0 186 if (error < 0)
319 186 0 if (workdir && !git__prefixcmp(ignores->dir.ptr, workdir))
186 0 if (workdir && !git__prefixcmp(ignores->dir.ptr, workdir))
323 0 186 if ((error = get_internal_ignores(&ignores->ign_internal, repo)) < 0)
327 186 0 if (workdir != NULL) {
330 0 186 if (error < 0)
335 186 0 if ((error = git_repository_item_path(&infopath, repo, GIT_REPOSITORY_ITEM_INFO)) < 0 ||
0 186 if ((error = git_repository_item_path(&infopath, repo, GIT_REPOSITORY_ITEM_INFO)) < 0 ||
337 0 0 if (error != GIT_ENOTFOUND)
343 0 186 if (git_repository_attr_cache(repo)->cfg_excl_file != NULL)
350 0 186 if (error < 0)
358 0 176 if (git_buf_joinpath(&ign->dir, ign->dir.ptr, dir) < 0)
369 359 0 if (ign->ign_path.length > 0) {
382 176 183 if ((end = strrchr(start, '/')) != NULL) {
387 176 0 if (pathlen == dirlen && !memcmp(relpath, start, dirlen)) {
176 0 if (pathlen == dirlen && !memcmp(relpath, start, dirlen)) {
394 176 183 if (--ign->depth > 0) {
409 186 218 git_vector_foreach(&ignores->ign_path, i, file) {
415 186 218 git_vector_foreach(&ignores->ign_global, i, file) {
430 2343 2678 git_vector_rforeach(&file->rules, j, match) {
431 0 2343 if (match->flags & GIT_ATTR_FNMATCH_DIRECTORY &&
0 0 if (match->flags & GIT_ATTR_FNMATCH_DIRECTORY &&
434 11 2332 if (git_attr_fnmatch__match(match, path)) {
453 0 764 if (git_attr_path__init(
458 10 754 if (ignore_lookup_in_rules(out, ignores->ign_internal, &path))
465 1164 754 git_vector_rforeach(&ignores->ign_path, i, file) {
466 0 1164 if (ignore_lookup_in_rules(out, file, &path))
471 754 754 git_vector_foreach(&ignores->ign_global, i, file) {
472 0 754 if (ignore_lookup_in_rules(out, file, &path))
486 0 2 if ((error = get_internal_ignores(&ign_internal, repo)) < 0)
500 0 0 if ((error = get_internal_ignores(&ign_internal, repo)) < 0)
503 0 0 if (!(error = git_attr_file__clear_rules(ign_internal, true)))
524 3 0 assert(repo && ignored && pathname);
3 0 assert(repo && ignored && pathname);
0 3 assert(repo && ignored && pathname);
531 0 3 if (!git__suffixcmp(pathname, "/"))
533 0 3 else if (git_repository_is_bare(repo))
536 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 ||
542 1 2 if (ignore_lookup_in_rules(ignored, ignores.ign_internal, &path))
546 2 2 git_vector_foreach(&ignores.ign_path, i, file) {
547 0 2 if (ignore_lookup_in_rules(ignored, file, &path))
552 2 2 git_vector_foreach(&ignores.ign_global, i, file) {
553 0 2 if (ignore_lookup_in_rules(ignored, file, &path))
558 2 0 if (path.basename == path.path)
561 0 0 while (path.basename > path.path && *path.basename != '/')
0 0 while (path.basename > path.path && *path.basename != '/')
563 0 0 if (path.basename > path.path)
567 0 0 if ((error = git_ignore__pop_dir(&ignores)) < 0)
592 0 0 if ((error = git_repository__ensure_not_bare(
593 0 0 repo, "validate pathspec")) < 0 ||
599 0 0 git_vector_foreach(vspec, i, match) {
601 0 0 if ((match->flags & GIT_ATTR_FNMATCH_HASWILD) != 0 &&
0 0 if ((match->flags & GIT_ATTR_FNMATCH_HASWILD) != 0 &&
608 0 0 if (git_index_get_bypath(idx, filename, 0) != NULL)
611 0 0 if ((error = git_buf_joinpath(&path, wd, filename)) < 0)
615 0 0 if (!git_path_isfile(path.ptr))
619 0 0 if ((error = git_ignore_path_is_ignored(&ignored, repo, filename)) < 0)
622 0 0 if (ignored) {