diff --git a/hooks/ponytail-map.js b/hooks/ponytail-map.js index 00e1c1191..03ec4a87e 100644 --- a/hooks/ponytail-map.js +++ b/hooks/ponytail-map.js @@ -36,7 +36,10 @@ const LANG = { py: 'py', js: 'js', jsx: 'js', mjs: 'js', cjs: 'js', ts: 'js', ts function listFiles(root) { try { - const tracked = execFileSync('git', ['ls-files'], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], timeout: 3000 }) + // 64 MiB: in repos with many tracked files `git ls-files` overflows Node's 1 MiB + // default, and the catch below reads that as "not a git repo" and falls back to a + // walk that ignores .gitignore. The list is capped at MAX_FILES * 5 lines anyway. + const tracked = execFileSync('git', ['ls-files'], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], timeout: 3000, maxBuffer: 64 * 1024 * 1024 }) .split('\n').filter(Boolean).slice(0, MAX_FILES * 5); if (tracked.length) return tracked; } catch (e) { /* not a git repo: walk below */ }