Use standard git diff output even when diff.external is configured - #1092
Use standard git diff output even when diff.external is configured#1092marvin-bitterlich wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can enforce grammar and style rules using `languagetool`.Configure the |
| @@ -0,0 +1,3 @@ | |||
| export function machineReadableGitDiffArgs(...args: ReadonlyArray<string>): ReadonlyArray<string> { | |||
There was a problem hiding this comment.
I don't think this helper really provides value since it increases the overall complexity by making you need to go to a different file to figure out what we're actually calling
imo you should just add the --no-ext-diff flag to the existing diff command call sites rather than trying to decrease duplication with a helper
Why?
T3 Code uses
git diffoutput to build patch and stat views in the app. When a user hasdiff.externalconfigured, those commands can return tool-specific output instead of standard unified diffs, which breaks parsing and rendering.How?
Added a small shared helper for machine-readable
git diffinvocations and used it for the server-side diff, stat, and numstat calls that feed status details, commit context, range context, and checkpoint diffs.Added regression tests that configure
diff.externaland verify the app still receives standard diff output.Decisions
Applied
--no-ext-diffonly to diff commands where T3 Code expects machine-readable output.Closes External diff tool breaks diff display #927
Note
Add
--no-ext-diffto all git diff invocations to ignore configured external diff toolsmachineReadableGitDiffArgshelper indiffArgs.tsthat prepends"diff"and"--no-ext-diff"to any provided git diff arguments.GitCore(statusDetails,prepareCommitContext,readRangeContext) andCheckpointStore(diffCheckpoints) to use this helper, ensuringdiff.externalconfig is ignored.GitCore.test.tsthat configure an external diff script and assert it is not invoked byprepareCommitContextorreadRangeContext.Macroscope summarized 115cf97.