* Use `git status` to detect changed files instead of scanning every file. * Returns null on failure so callers fall back to full scan. * * Recurses into embedded repos — the untracked kind (#193: the parent's status * collapses them to an opaque `?? subdir/` entry) always, and the gitignored *
(rootDir: string)
| 1090 | * with it); a full `codegraph index` reconciles that. |
| 1091 | */ |
| 1092 | function getGitChangedFiles(rootDir: string): GitChanges | null { |
| 1093 | try { |
| 1094 | const changes: GitChanges = { modified: [], added: [], deleted: [] }; |
| 1095 | // Custom extension → language overrides from the project's codegraph.json, |
| 1096 | // so change detection sees the same custom-extension files the full index does. |
| 1097 | const overrides = loadExtensionOverrides(rootDir); |
| 1098 | collectGitStatus(rootDir, '', changes, overrides, loadIncludeIgnoredMatcher(rootDir), loadExcludeMatcher(rootDir)); |
| 1099 | return changes; |
| 1100 | } catch { |
| 1101 | return null; |
| 1102 | } |
| 1103 | } |
| 1104 | |
| 1105 | function collectGitStatus(repoDir: string, prefix: string, out: GitChanges, overrides?: Record<string, Language>, includeIgnored: Ignore | null = null, exclude: Ignore | null = null): void { |
| 1106 | const output = execFileSync( |
no test coverage detected