Repository navigation
fix(map): raise the git ls-files buffer so large repos keep tracked files - #1156
Merged
DietrichGebert merged 1 commit intoOct 17, 2026
Conversation
…iles
listFiles() called execFileSync('git', ['ls-files']) with Node's default 1 MiB maxBuffer. In a repo whose tracked-file list exceeds that, the call throws ENOBUFS, the catch treats every error as 'not a git repo', and the map silently falls back to a directory walk that does not honour .gitignore, so untracked and ignored folders are listed instead of tracked source. Raise maxBuffer to 64 MiB; the result is already capped at MAX_FILES * 5 lines. Fixes DietrichGebert#1149.
Owner
|
Thanks! Tested it, works great. Merged, will be in the next release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1149
What
listFiles()inhooks/ponytail-map.jscalledexecFileSync('git', ['ls-files'])without amaxBuffer, so it inherited Node's 1 MiB default. When a repository's tracked-file list exceeds that, the call throwsENOBUFS. The surroundingcatchtreats every error as "not a git repo" and falls back to the directory walk, which does not honour.gitignore— so the map injected at SessionStart lists untracked and ignored folders instead of tracked source, and those entries consume the 2,000-character budget.The change adds
maxBuffer: 64 * 1024 * 1024to that call, plus a comment explaining why the number is what it is. The result is already capped atMAX_FILES * 5lines immediately afterwards, so the larger buffer cannot make the map bigger.Why this one and not the fallback change
The issue also suggests narrowing the
catchso the walk is only used when git actually reports "not a git repository". That is a behaviour change to a different failure mode (timeouts), so I left it out to keep this to one concern. Happy to follow up separately if you want it.Verification
hooks/ponytail-map.js:39passes nomaxBuffer, and thathooks/ponytail-map.js:42swallows the error withcatch (e) { /* not a git repo: walk below */ }.execFileSyncwith default options:ERRCODE=ENOBUFS. Repeating withmaxBuffer: 64 * 1024 * 1024:ok.git ls-filesprints 60,239 characters (~33 chars per path), so roughly 32k tracked files at that depth would cross 1 MiB. The reported repo with ~21k files prints ~1.7 MB.npm test— 172 passed, 0 failed, 2 skipped, exit 0.node scripts/check-rule-copies.js— rule copies match, exit 0.node scripts/check-versions.js— 7 version files pinned at 5.3.2, exit 0.node --check hooks/ponytail-map.js— parses.Per CONTRIBUTING this is a hook fix, so no benchmark: the change touches none of the ruleset,
skills/,AGENTS.md, or the rule copies.Scope
One file, one added option. No behaviour change for repositories where
git ls-filesalready fits in the default buffer.