fix(git): upstream diff-format, untracked-range and large-repo fixes (#31, #26, #36) - #3
Merged
Conversation
User git config such as diff.mnemonicPrefix, diff.noprefix, custom src/dst prefixes, color.ui=always, or diff.external changes the output of `git diff` so the parser's `diff --git a/… b/…` header no longer matches, resulting in an empty diff. Force a standard, parseable format by passing --no-color, --no-ext-diff and --src-prefix=a/ --dst-prefix=b/ to all diff-producing invocations.
getWorkingTreeFiles and getTreeFingerprint called execFileSync without a maxBuffer, so they inherited Node's 1 MB default. In a monorepo whose git ls-files output is 2.3 MB across ~29k files, every call died with spawnSync git ENOBUFS and the UI showed 'Failed to get tree' — the file browser and any tour that reads the tree were unusable. exec.ts already had the 50 MB ceiling these calls needed, but only for its string-command helpers; tree.ts passes argv arrays, which it should, because a repository path can contain a space or a quote. So this adds execFileLarge as the argv form of execLarge, names the shared constant, and routes tree.ts through it.
Upstream nilbuild#31 applies DIFF_FORMAT_ARGS to getDiff and getUntrackedDiff but not to getDiffFiles or getDiffStat, so `color.ui=always` still injects ANSI escapes into the file names that get parsed and into the diffstat. Upstream #21 covered those two call sites with --no-ext-diff alone; apply the whole set to both. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs
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.
Three upstream correctness fixes, merged unmodified, plus one gap closed.
color.ui=always, a configureddiff.external,diff.mnemonicPrefix/diff.noprefix). Matters here as soon as anyone sets difftastic or delta as an external diff driver.A..Bmatchesgit diff A..B.git ls-filesin a ~29k-file repo exceeds Node's 1 MB default buffer and the child process dies with ENOBUFS, breaking the file tree. NCBackend3, NCApp3 and NCWeb are that size. Also moves tree commands to argv-form exec, so paths with spaces or quotes stop going through a shell.On top: nilbuild#31 applies its flags to
getDiff/getUntrackedDiffbut not togetDiffFiles(
--name-only) orgetDiffStat(--stat), wherecolor.ui=alwaysinjects ANSI escapes straightinto parsed file names. #21 covered those two call
sites with
--no-ext-diffalone; this applies the whole set and extends nilbuild#31's test file to both,which makes #21 redundant.
135 tests pass.
Stacked on #2.
🤖 Generated with Claude Code
https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs