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