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

Function buildScopeIgnore

src/extraction/index.ts:1134–1149  ·  view source on GitHub ↗
(rootDir: string, embeddedRoots?: Iterable<string>, ignoredEntries?: string[])

Source from the content-addressed store, hash-verified

1132 * skip rediscovery; otherwise they're discovered here (the watcher path).
1133 */
1134export function buildScopeIgnore(rootDir: string, embeddedRoots?: Iterable<string>, ignoredEntries?: string[]): ScopeIgnore {
1135 const roots = embeddedRoots ? [...embeddedRoots] : discoverEmbeddedRepoRoots(rootDir);
1136 const include = loadIncludeMatcher(rootDir);
1137 // The root matcher has defaults + root `.gitignore` + info/exclude +
1138 // core.excludesFile. The ignored-untracked directories git reports join
1139 // them, so nested `.gitignore` effects prune the watcher identically to the
1140 // indexer (#1728) — as literal paths, not patterns (#2849).
1141 return new ScopeIgnore(
1142 buildDefaultIgnore(rootDir),
1143 roots.map((root) => ({ root, matcher: buildDefaultIgnore(path.join(rootDir, root)) })),
1144 loadExcludeMatcher(rootDir),
1145 include,
1146 include ? includeStaticRoots(loadIncludePatterns(rootDir)) : [],
1147 new Set(listGitIgnoredDirectories(rootDir, ignoredEntries)),
1148 );
1149}
1150
1151/**
1152 * Whether an embedded repo found as a tracked gitlink (mode 160000, #1031/#1033)

Callers 10

startMethod · 0.90
refreshScopeMethod · 0.90
scopeFunction · 0.90
extraction.test.tsFile · 0.90
getGitVisibleFilesFunction · 0.85
scopedSyncMatcherMethod · 0.85

Calls 9

loadIncludePatternsFunction · 0.90
loadIncludeMatcherFunction · 0.85
buildDefaultIgnoreFunction · 0.85
loadExcludeMatcherFunction · 0.85
includeStaticRootsFunction · 0.85
mapMethod · 0.80
joinMethod · 0.45

Tested by 1

scopeFunction · 0.72