The best way to control Claude Code, Codex and more from any computer or phone
fix(server): commits and PR text see changes outside a subfolder project under diff.relative (#29879)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Alex Southwell committed
Nov 3, 2026 at 17:23 UTC
e86dc78d6294e99cef47888fe1513b647da48e5d
2 files changed
+21
-5
apps/server/src/vcs/GitVcsDriverCore.test.ts
+6
-3
@@ -2849,12 +2849,13 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
2849
}),
2850
);
2851
2852
- it.effect("reads range patches from source without textconv or color", () =>
2852
+ it.effect("reads range patches from source without textconv, color, or diff.relative", () =>
2853
Effect.gen(function* () {
2854
const cwd = yield* makeTmpDir();
2855
const { initialBranch } = yield* initRepoWithCommit(cwd);
2856
yield* git(cwd, ["config", "diff.probe.textconv", "touch textconv-ran; echo converted"]);
2857
yield* git(cwd, ["config", "color.ui", "always"]);
2858
+ yield* git(cwd, ["config", "diff.relative", "true"]);
2859
yield* git(cwd, ["checkout", "-b", "feature/range"]);
2860
yield* writeTextFile(cwd, ".gitattributes", "*.doc diff=probe\n");
2861
yield* writeTextFile(cwd, "notes.doc", "source line\n");
@@ -2864,8 +2865,10 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
2865
yield* git(cwd, ["commit", "-m", "range files"]);
2866
const driver = yield* GitVcsDriver.GitVcsDriver;
2867
const fileSystem = yield* FileSystem.FileSystem;
2868
+ const projectCwd = `${cwd}/app`;
2869
+ yield* fileSystem.makeDirectory(projectCwd);
2870
2868
- const context = yield* driver.readRangeContext(cwd, initialBranch);
2871
+ const context = yield* driver.readRangeContext(projectCwd, initialBranch);
2872
2873
assert.include(context.diffPatch, "+source line");
2874
assert.notInclude(context.diffPatch, "converted");
@@ -2878,7 +2881,7 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
2881
assert.isFalse(yield* fileSystem.exists(`${cwd}/textconv-ran`));
2882
2883
yield* writeTextFile(cwd, "notes.doc", "updated source line\n");
2881
- const staged = yield* driver.prepareCommitContext(cwd, ["notes.doc"]);
2884
+ const staged = yield* driver.prepareCommitContext(projectCwd, ["notes.doc"]);
2885
assert.include(staged?.stagedPatch ?? "", "+updated source line");
2886
assert.notInclude(staged?.stagedPatch ?? "", "converted");
2887
assert.notInclude(staged?.stagedPatch ?? "", "\u001b[");
apps/server/src/vcs/GitVcsDriverCore.ts
+15
-2
@@ -2525,7 +2525,8 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2525
const stagedSummary = yield* runGitStdoutWithOptions(
2526
"GitVcsDriver.prepareCommitContext.stagedSummary",
2527
cwd,
2528
- ["diff", "--cached", "--name-status"],
2528
+ // cwd can be a subdirectory; diff.relative would hide changes outside it.
2529
+ ["-c", "diff.relative=false", "diff", "--cached", "--name-status"],
2530
{ env, maxOutputBytes: REVIEW_METADATA_MAX_OUTPUT_BYTES },
2531
).pipe(Effect.map((stdout) => stdout.trim()));
2532
if (stagedSummary.length === 0) {
@@ -2539,6 +2540,8 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2540
"GitVcsDriver.prepareCommitContext.stagedPatch",
2541
cwd,
2542
[
2543
+ "-c",
2544
+ "diff.relative=false",
2545
"diff",
2546
"--no-color",
2547
"--no-ext-diff",
@@ -2948,7 +2951,15 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2951
runGitStdoutWithOptions(
2952
"GitVcsDriver.readRangeContext.diffStat",
2953
cwd,
2951
- ["diff", "--stat", "--no-color", "--end-of-options", diffRange],
2954
+ [
2955
+ "-c",
2956
+ "diff.relative=false",
2957
+ "diff",
2958
+ "--stat",
2959
+ "--no-color",
2960
+ "--end-of-options",
2961
+ diffRange,
2962
+ ],
2963
{
2964
maxOutputBytes: RANGE_DIFF_SUMMARY_MAX_OUTPUT_BYTES,
2965
appendTruncationMarker: true,
@@ -2958,6 +2969,8 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2969
"GitVcsDriver.readRangeContext.diffPatch",
2970
cwd,
2971
[
2972
+ "-c",
2973
+ "diff.relative=false",
2974
"diff",
2975
"--no-color",
2976
"--no-ext-diff",