fix(git): pass --no-ext-diff when diffing untracked files#259
Conversation
Greptile SummaryThis PR fixes a crash in
Confidence Score: 3/5The untracked-file fix is correct and well-tested, but The fix is correct and directly addresses the reported crash. However,
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[hunk diff] --> B{File type?}
B -->|Tracked changes| C[buildGitDiffArgs\n--no-ext-diff ✓]
B -->|Commit show| D[buildGitShowArgs\n--no-ext-diff ✓]
B -->|Untracked file| E[buildGitNewFileDiffArgs\n--no-ext-diff ✓ FIXED]
B -->|Stash show| F[buildGitStashShowArgs\n--no-ext-diff ✗ MISSING]
C --> G[Unified diff output → parser]
D --> G
E --> G
F -->|diff.external configured| H[External tool output → parser CRASH]
F -->|No diff.external| G
|
A user-configured diff.external (e.g. difftastic, delta) replaced git's unified-diff output for the synthetic untracked-file patch, leaving Pierre nothing to parse and crashing `hunk diff` with "Expected one parsed file for untracked patch ..., got 0". The other git invocations already pass --no-ext-diff for this exact reason; the untracked path just missed it.
a804c81 to
298498d
Compare
|
Addressed the Greptile note by making This comment was generated by Pi using OpenAI GPT-5 |
Summary
If you have
diff.externalset in git config (difftastic, delta, etc.),hunk diffcrashes on any untracked file:hunk forms untracked patches via
git diff --no-index, which honorsdiff.externaland outputs whatever that tool prints instead of unified diff. The regular diff/show paths already use--no-ext-diff, the untracked path was missing it.Test
diff.externalon a temp repo and loads an untracked file.diff.external = difft; works after the fix.