The best way to control Claude Code, Codex and more from any computer or phone
fix(server): diffs keep blank context lines under diff.suppressBlankEmpty (#29579)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Alex Southwell committed
Nov 3, 2026 at 01:41 UTC
35af84977d0ee55c13c3b81c3f8d5427279c6de2
4 files changed
+15
-5
apps/server/src/checkpointing/CheckpointStore.test.ts
+5
-2
@@ -153,21 +153,23 @@ it.layer(layerTest)("CheckpointStore.layer", (it) => {
153
}),
154
);
155
156
- it.effect("keeps a/ and b/ patch prefixes when the repository disables them", () =>
156
+ it.effect("keeps the patch format clients parse when the repository changes it", () =>
157
Effect.gen(function* () {
158
const tmp = yield* makeTmpDir();
159
yield* initRepoWithCommit(tmp);
160
yield* git(tmp, ["config", "diff.noprefix", "true"]);
161
+ yield* git(tmp, ["config", "diff.suppressBlankEmpty", "true"]);
162
const checkpointStore = yield* CheckpointStore.CheckpointStore;
163
const threadId = ThreadId.make("thread-checkpoint-store-noprefix");
164
const fromCheckpointRef = checkpointRefForThreadTurn(threadId, 0);
165
const toCheckpointRef = checkpointRefForThreadTurn(threadId, 1);
166
167
+ yield* writeTextFile(NodePath.join(tmp, "README.md"), "# test\n\nbefore\n");
168
yield* checkpointStore.captureCheckpoint({
169
cwd: tmp,
170
checkpointRef: fromCheckpointRef,
171
});
170
- yield* writeTextFile(NodePath.join(tmp, "README.md"), "# changed\n");
172
+ yield* writeTextFile(NodePath.join(tmp, "README.md"), "# test\n\nafter\n");
173
yield* checkpointStore.captureCheckpoint({
174
cwd: tmp,
175
checkpointRef: toCheckpointRef,
@@ -181,6 +183,7 @@ it.layer(layerTest)("CheckpointStore.layer", (it) => {
183
});
184
185
expect(diff).toContain("diff --git a/README.md b/README.md");
186
+ expect(diff).toContain(" # test\n \n-before\n+after\n");
187
}),
188
);
189
apps/server/src/vcs/GitVcsDriver.ts
+2
@@ -1377,6 +1377,8 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
1377
// Not --no-relative, which Git before 2.28 rejects.
1378
"-c",
1379
"diff.relative=false",
1380
+ "-c",
1381
+ "diff.suppressBlankEmpty=false",
1382
"diff",
1383
...(input.format === "numstat" ? ["--numstat", "-z"] : ["--patch"]),
1384
"--no-color",
apps/server/src/vcs/GitVcsDriverCore.test.ts
+5
-3
@@ -2397,18 +2397,19 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
2397
}),
2398
);
2399
2400
- it.effect("keeps a/ and b/ patch prefixes when the repository disables them", () =>
2400
+ it.effect("keeps the patch format clients parse when the repository changes it", () =>
2401
Effect.gen(function* () {
2402
const cwd = yield* makeTmpDir();
2403
const { initialBranch } = yield* initRepoWithCommit(cwd);
2404
const driver = yield* GitVcsDriver.GitVcsDriver;
2405
yield* git(cwd, ["config", "diff.noprefix", "true"]);
2406
yield* git(cwd, ["config", "diff.mnemonicPrefix", "true"]);
2407
+ yield* git(cwd, ["config", "diff.suppressBlankEmpty", "true"]);
2408
yield* git(cwd, ["checkout", "-b", "feature/noprefix"]);
2408
- yield* writeTextFile(cwd, "README.md", "# committed change\n");
2409
+ yield* writeTextFile(cwd, "README.md", "# test\n\ncommitted change\n");
2410
yield* git(cwd, ["add", "README.md"]);
2411
yield* git(cwd, ["commit", "-m", "committed change"]);
2411
- yield* writeTextFile(cwd, "README.md", "# dirty change\n");
2412
+ yield* writeTextFile(cwd, "README.md", "# test\n\ndirty change\n");
2413
yield* writeTextFile(cwd, "untracked.txt", "untracked\n");
2414
2415
const preview = yield* driver.getReviewDiffPreview({
@@ -2420,6 +2421,7 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
2421
const workingTree = preview.sources.find((source) => source.kind === "working-tree")?.diff;
2422
const branchRange = preview.sources.find((source) => source.kind === "branch-range")?.diff;
2423
assert.include(workingTree, "diff --git a/README.md b/README.md");
2424
+ assert.include(workingTree, " # test\n \n-committed change\n+dirty change\n");
2425
assert.include(workingTree, "+++ b/untracked.txt");
2426
assert.include(branchRange, "diff --git a/README.md b/README.md");
2427
}),
apps/server/src/vcs/GitVcsDriverCore.ts
+3
@@ -81,7 +81,10 @@ const REVIEW_BRANCH_SUBJECT_LIMIT = 300;
81
const REVIEW_BRANCH_COMMIT_MAX_OUTPUT_BYTES = 128 * 1024;
82
// Client patch parsers require a/ and b/ prefixes; override user diff prefix settings.
83
export const PATCH_RENDER_PREFIX_ARGS = ["--src-prefix=a/", "--dst-prefix=b/"] as const;
84
+// Client patch parsers drop blank context lines that diff.suppressBlankEmpty prints without a space.
85
const REVIEW_DIFF_ARGS = [
86
+ "-c",
87
+ "diff.suppressBlankEmpty=false",
88
"diff",
89
"--find-renames",
90
"--no-color",