Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion hooks/ponytail-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */ }
Expand Down
Loading