Skip to content

fix(git): upstream diff-format, untracked-range and large-repo fixes (#31, #26, #36) - #3

Merged
fiddur merged 7 commits into
developfrom
upstream-git-fixes
Aug 21, 2026
Merged

fix(git): upstream diff-format, untracked-range and large-repo fixes (#31, #26, #36)#3
fiddur merged 7 commits into
developfrom
upstream-git-fixes

Conversation

@fiddur

@fiddur fiddur commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Three upstream correctness fixes, merged unmodified, plus one gap closed.

  • #31 @sdirix — neutralizes git config that corrupts diff parsing (color.ui=always, a configured diff.external, diff.mnemonicPrefix/diff.noprefix). Matters here as soon as anyone sets difftastic or delta as an external diff driver.
  • #26 @stuartsaunders — excludes untracked working-tree files from ref-range diffs, so A..B matches git diff A..B.
  • #36 @gustavo-depaulagit ls-files in 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/getUntrackedDiff but not to getDiffFiles
(--name-only) or getDiffStat (--stat), where color.ui=always injects ANSI escapes straight
into parsed file names. #21 covered those two call
sites with --no-ext-diff alone; 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

stuartsaunders and others added 7 commits July 5, 2026 10:42
- #11 enabled includeUntracked for the whole default case (bare refs)
- That catch-all also covers A..B ranges with both endpoints pinned
- Untracked overlay made range diffs disagree with git diff A..B
- Gate inclusion on ref not being a range; bare refs keep #10 behavior
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
@fiddur
fiddur changed the base branch from node-sqlite to develop August 21, 2026 13:33
@fiddur
fiddur marked this pull request as ready for review August 21, 2026 13:33
@fiddur
fiddur merged commit 0f89dcb into develop Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants