Skip to content

Pin the a/ and b/ prefixes on every Git patch local-vcs reads - #1546

Open
JaynouOliver wants to merge 1 commit into
devdotfast:mainfrom
JaynouOliver:fix/pin-git-diff-prefixes
Open

JaynouOliver wants to merge 1 commit into
devdotfast:mainfrom
JaynouOliver:fix/pin-git-diff-prefixes

Conversation

@JaynouOliver

Copy link
Copy Markdown

readGitDiff runs git diff under the user's Git config, and splitGitPatchFiles finds paths by stripping a/ or b/. With diff.mnemonicPrefix=true every working-tree path comes back as w/src/app.ts; with diff.noprefix=true a file under a top-level a/ directory loses it (a/util.ts becomes util.ts). diff.srcPrefix / diff.dstPrefix do the same.

The fix passes --src-prefix=a/ --dst-prefix=b/ to that git diff, which overrides all three settings.

Tested with pnpm --filter @dev.fast/local-vcs test: the new test in working-diff.test.ts fails for both settings without the change (2 failed | 3 passed) and the package passes with it (81 passed | 5 skipped).

Not verified: diff.srcPrefix (my Git is 2.43), the full pnpm run ci, and a running Desktop. There is no issue for this; I found it reading the code.

@JaynouOliver
JaynouOliver marked this pull request as ready for review November 14, 2026 23:01
`splitGitPatchFiles` strips a leading `a/` or `b/` from patch paths, but
`diff.mnemonicPrefix`, `diff.noprefix` and `diff.srcPrefix` /
`diff.dstPrefix` in the user's Git config change those prefixes, so
paths came back as `w/src/app.ts` or lost a top-level `a/` directory.

Pass `--src-prefix=a/ --dst-prefix=b/` to `git diff`, which wins over
all three settings.
@JaynouOliver
JaynouOliver force-pushed the fix/pin-git-diff-prefixes branch from 806807c to 409c853 Compare November 17, 2026 05:33

This branch has not been deployed

No deployments
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.

1 participant