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

Function buildScopeIgnore

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

Source from the content-addressed store, hash-verified

1116 * skip rediscovery; otherwise they're discovered here (the watcher path).
1117 */
1118export function buildScopeIgnore(rootDir: string, embeddedRoots?: Iterable<string>, ignoredEntries?: string[]): ScopeIgnore {
1119 const roots = embeddedRoots ? [...embeddedRoots] : discoverEmbeddedRepoRoots(rootDir);
1120 const include = loadIncludeMatcher(rootDir);
1121 // The root matcher has defaults + root `.gitignore` + info/exclude +
1122 // core.excludesFile. The ignored-untracked directories git reports join
1123 // them, so nested `.gitignore` effects prune the watcher identically to the
1124 // indexer (#1728) — as literal paths, not patterns (#2849).
1125 return new ScopeIgnore(
1126 buildDefaultIgnore(rootDir),
1127 roots.map((root) => ({ root, matcher: buildDefaultIgnore(path.join(rootDir, root)) })),
1128 loadExcludeMatcher(rootDir),
1129 include,
1130 include ? includeStaticRoots(loadIncludePatterns(rootDir)) : [],
1131 new Set(listGitIgnoredDirectories(rootDir, ignoredEntries)),
1132 );
1133}
1134
1135/**
1136 * 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