| 1116 | * skip rediscovery; otherwise they're discovered here (the watcher path). |
| 1117 | */ |
| 1118 | export 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) |