fix(server): keep a/ and b/ prefixes in rendered git patches - #9438
Merged
Conversation
A user-level diff.noprefix or diff.mnemonicPrefix leaked into the patches the server hands to the clients. The diff renderer only recognizes git's default a/ and b/ prefixes, so every file in such a patch parsed with an empty name, and the diff panel crashed on duplicate ids as soon as a diff contained two files. Pin the prefixes with --src-prefix/--dst-prefix on the review preview, untracked, and checkpoint diff commands. Fixes pingdotgg#9427
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small, self-contained server fix that normalizes Git patch prefixes at existing rendering points, with integration coverage for repository prefix settings. It does not introduce a new capability, schema change, deployment change, or static-analysis override. You can add or adjust custom eligibility rules. Learn more. |
github-actions Bot
added a commit
to omarcresp/t3code-flake
that referenced
this pull request
Sep 4, 2026
## What's Changed * fix(web): make right panel tabs easier to scroll by @maria-rcks in pingdotgg/t3code#9461 * fix(web): render transparent previews on white by @UtkarshUsername in pingdotgg/t3code#9463 * fix(mobile): show loading and syncing in the working pill by @juliusmarminge in pingdotgg/t3code#9466 * fix(server): keep a/ and b/ prefixes in rendered git patches by @Mnigos in pingdotgg/t3code#9438 * fix(server): full-access OpenCode threads no longer ask for approvals by @shivamhwp in pingdotgg/t3code#9282 * fix(web): reuse pull request list data while loading by @maria-rcks in pingdotgg/t3code#9467 * feat(web): let users turn off composer collapse on blur and scroll by @juliusmarminge in pingdotgg/t3code#9469 ## New Contributors * @Mnigos made their first contribution in pingdotgg/t3code#9438 **Full Changelog**: pingdotgg/t3code@v0.0.39-nightly.20260903.1272...v0.0.39-nightly.20260903.1273 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.39-nightly.20260903.1273
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.
When the user's git config sets
diff.noprefixordiff.mnemonicPrefix, the patches the server hands to the clients lose theira/andb/path prefixes. The diff renderer only recognizes the default prefixes, so every file in such a patch parses with an empty name, and opening the diff panel crashes withCodeView.addItem: duplicate id ""as soon as the diff contains two files. Reloading crashes again immediately because the panel reopens into the same state.The review preview, untracked, and checkpoint diff commands now pin the prefixes with
--src-prefix=a/ --dst-prefix=b/, which wins over the user's config on every git version I could test. Patches that only feed text generation are left alone.Covered by tests that run the real driver against a repository configured with
diff.noprefix=true; both fail without the fix.Fixes #9427.
Implemented with Claude Code (Claude Fable 5).
Note
Low Risk
Localized VCS diff flag change with regression tests; no auth, data, or API contract changes.
Overview
Fixes broken diff UI when a repo’s Git config sets
diff.noprefixordiff.mnemonicPrefix, which strips the defaulta//b/path prefixes from patches. The client parser only recognizes those prefixes, so files end up with empty names and the diff panel can crash on multi-file diffs.Server-side
git diffcalls that feed the review preview, untracked diffs, and checkpoint diffs now pass--src-prefix=a/and--dst-prefix=b/via sharedPATCH_RENDER_PREFIX_ARGS, overriding user config. Diffs used only for text summaries (e.g. staged commit context) are unchanged.Integration tests configure
diff.noprefix(and mnemonic prefix in the driver test) and assert patches still containdiff --git a/... b/....Reviewed by Cursor Bugbot for commit 6691bc3. Configure here.
Note
Fix
GitVcsDriverpatch rendering to keepa/andb/prefixesGit config options like
diff.noprefixordiff.mnemonicPrefixcould strip or alter the standarda//b/path prefixes in rendered patches, breaking parsers that expect them.PATCH_RENDER_PREFIX_ARGSin GitVcsDriverCore.ts and applies it to checkpoint diffs, working-tree review diffs, branch-range review diffs, and untracked-file (--no-index) review diffsdiff.noprefixanddiff.mnemonicPrefixscenariosa//b/prefixes regardless of repository or global git diff settings📊 Macroscope summarized 6691bc3. 2 files reviewed, 1 issue evaluated, 1 issue filtered, 0 comments posted
🗂️ Filtered Issues
apps/server/src/vcs/GitVcsDriverCore.ts — 0 comments posted, 1 evaluated, 1 filtered
PATCH_RENDER_PREFIX_ARGSdoes not disablediff.mnemonicPrefix. Git's documented--default-prefixoption is the one that overridesdiff.mnemonicPrefix; supplying only custom source/destination prefixes leaves that configuration enabled. Consequently, repositories withdiff.mnemonicPrefix=truestill emit prefixes such asi/,w/,c/, oro/, which the client parser does not recognize, so a multi-file review/checkpoint patch can again create duplicate empty file IDs and crash the diff panel. [ Out of scope (triage) ]