MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / ignores

Method ignores

src/extraction/index.ts:655–687  ·  view source on GitHub ↗
(rel: string)

Source from the content-addressed store, hash-verified

653 }
654
655 ignores(rel: string): boolean {
656 // User `exclude` (#999) is checked first and against the full root-relative
657 // path: it must drop git-TRACKED paths (which `.gitignore` can't) and apply
658 // everywhere, including ancestors of embedded repos.
659 if (this.exclude && this.exclude.ignores(rel)) return true;
660 // User `include`: force first-party source in despite `.gitignore`. Never
661 // resurfaces a built-in default-ignored dir (node_modules/dist/…), so an
662 // include pattern can't accidentally pull in dependency/build trees.
663 if (this.include && !this.defaults.ignores(rel)) {
664 if (rel.endsWith('/')) {
665 // A directory on (or leading to) an included subtree must stay walkable
666 // so the watcher/walker descends to reach the forced-in files.
667 if (this.includeRoots.some((r) => r.startsWith(rel) || rel.startsWith(r))) return false;
668 } else if (this.include.ignores(rel)) {
669 return false;
670 }
671 }
672 for (const { root, matcher } of this.embedded) {
673 if (rel.startsWith(root)) {
674 const inner = rel.slice(root.length);
675 if (inner === '') return false;
676 // Built-in defaults apply to the FULL path uniformly (#407) — an
677 // embedded repo inside node_modules (an npm git-dependency) must stay
678 // excluded even though its own rules wouldn't ignore its files.
679 return this.defaults.ignores(rel) || matcher.ignores(inner);
680 }
681 }
682 // Never prune a directory that leads to an embedded repo.
683 if (rel.endsWith('/') && this.embedded.some(({ root }) => root.startsWith(rel))) {
684 return false;
685 }
686 return this.rootMatcher.ignores(rel);
687 }
688}
689
690/**

Callers 15

readGitignorePatternsFunction · 0.80
considerFunction · 0.80
findNestedGitReposFunction · 0.80
visitFunction · 0.80
findIgnoredEmbeddedReposFunction · 0.80
collectGitFilesFunction · 0.80
getGitVisibleFilesFunction · 0.80
collectGitStatusFunction · 0.80
isIgnoredFunction · 0.80
handleChangeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected