* Discover embedded repos hidden by `repoDir`'s OWN gitignore rules: for each * gitignored directory, search for nested `.git` roots. Returns repo paths * relative to `repoDir`, trailing-slashed. * * OPT-IN ONLY. Walking into a gitignored directory contradicts what every other * tool (and CodeG
(repoDir: string, includeIgnored: Ignore | null, prefix: string)
| 1321 | * default excludes (`node_modules`, …) are always skipped. |
| 1322 | */ |
| 1323 | function findIgnoredEmbeddedRepos(repoDir: string, includeIgnored: Ignore | null, prefix: string): string[] { |
| 1324 | if (!includeIgnored) return []; |
| 1325 | const defaults = defaultsOnlyIgnore(); |
| 1326 | const repos: string[] = []; |
| 1327 | for (const dir of listIgnoredDirs(repoDir)) { |
| 1328 | if (defaults.ignores(dir)) continue; |
| 1329 | const nested = findNestedGitRepos(path.join(repoDir, dir), dir); |
| 1330 | if (includeIgnored.ignores(normalizePath(prefix + dir))) { |
| 1331 | // The whole ignored dir is opted in — every nested repo under it counts. |
| 1332 | repos.push(...nested); |
| 1333 | } else { |
| 1334 | // A single gitignore rule often covers the PARENT of the opted-in |
| 1335 | // repos: `.gitignore: /repos/` lists `repos/` as ONE ignored entry, |
| 1336 | // while `includeIgnored: ["repos/a/"]` (the CLI hint's own suggested |
| 1337 | // spelling) names the child — which never matches the parent path, so |
| 1338 | // the opt-in silently did nothing (#1295). Match each nested repo |
| 1339 | // root individually so both spellings work. The walk is bounded |
| 1340 | // (depth/entry caps in findNestedGitRepos) and only runs when |
| 1341 | // includeIgnored is configured at all. |
| 1342 | repos.push(...nested.filter((r) => includeIgnored.ignores(normalizePath(prefix + r)))); |
| 1343 | } |
| 1344 | } |
| 1345 | return repos; |
| 1346 | } |
| 1347 | |
| 1348 | /** |
| 1349 | * `git ls-files -z -s -t`, expanding submodules where git allows it. |
no test coverage detected