@devries-cameron20 / t3code Mirror · read-only / commits / 071660e0ba
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 07:00 UTC

fix(server): Uncommitted review keeps a staged deletion that git pairs into a rename (#29571)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Alex Southwell committed Nov 3, 2026 at 01:37 UTC 071660e0bab80af5453b66ac7c335059ce10193a
2 files changed +33 -16
apps/server/src/vcs/GitVcsDriverCore.test.ts
+23 -15
@@ -2417,23 +2417,31 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
2417 }),
2418 );
2419
2420 - it.effect("preserves a staged deletion when the removed path still exists", () =>
2421 - Effect.gen(function* () {
2422 - const cwd = yield* makeTmpDir();
2423 - yield* initRepoWithCommit(cwd);
2424 - const driver = yield* GitVcsDriver.GitVcsDriver;
2425 - yield* writeTextFile(cwd, "removed.txt", "remove me\n");
2426 - yield* git(cwd, ["add", "removed.txt"]);
2427 - yield* git(cwd, ["commit", "-m", "add removable file"]);
2428 - yield* git(cwd, ["rm", "--cached", "removed.txt"]);
2420 + it.effect.each([
2421 + { stagedCopy: false, expected: ["deleted file mode", "-remove me"] },
2422 + { stagedCopy: true, expected: ["rename from removed.txt", "rename to copy.txt"] },
2423 + ])(
2424 + "preserves a staged deletion when the removed path still exists (staged copy: $stagedCopy)",
2425 + ({ stagedCopy, expected }) =>
2426 + Effect.gen(function* () {
2427 + const cwd = yield* makeTmpDir();
2428 + yield* initRepoWithCommit(cwd);
2429 + const driver = yield* GitVcsDriver.GitVcsDriver;
2430 + yield* writeTextFile(cwd, "removed.txt", "remove me\n");
2431 + yield* git(cwd, ["add", "removed.txt"]);
2432 + yield* git(cwd, ["commit", "-m", "add removable file"]);
2433 + yield* git(cwd, ["rm", "--cached", "removed.txt"]);
2434 + if (stagedCopy) {
2435 + yield* writeTextFile(cwd, "copy.txt", "remove me\n");
2436 + yield* git(cwd, ["add", "copy.txt"]);
2437 + }
2438
2430 - const preview = yield* driver.getReviewDiffPreview({ cwd, ignoreWhitespace: false });
2431 - const diff = preview.sources.find((source) => source.kind === "working-tree")?.diff ?? "";
2439 + const preview = yield* driver.getReviewDiffPreview({ cwd, ignoreWhitespace: false });
2440 + const diff = preview.sources.find((source) => source.kind === "working-tree")?.diff ?? "";
2441
2433 - assert.include(diff, "deleted file mode");
2434 - assert.include(diff, "-remove me");
2435 - assert.notInclude(diff, "new file mode");
2436 - }),
2442 + for (const text of expected) assert.include(diff, text);
2443 + assert.notInclude(diff, "new file mode");
2444 + }),
2445 );
2446
2447 it.effect.each([false, true])(
apps/server/src/vcs/GitVcsDriverCore.ts
+10 -1
@@ -2984,7 +2984,16 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2984 runGitStdoutWithOptions(
2985 "GitVcsDriver.readUnifiedWorkingTreeReviewDiff.stagedDeletions",
2986 cwd,
2987 - ["diff", "--cached", "--name-only", "--diff-filter=D", "-z", "HEAD", "--"],
2987 + [
2988 + "diff",
2989 + "--cached",
2990 + "--no-renames",
2991 + "--name-only",
2992 + "--diff-filter=D",
2993 + "-z",
2994 + "HEAD",
2995 + "--",
2996 + ],
2997 { allowNonZeroExit: true, maxOutputBytes: REVIEW_METADATA_MAX_OUTPUT_BYTES },
2998 ),
2999 runGitStdout("GitVcsDriver.readUnifiedWorkingTreeReviewDiff.indexPath", cwd, [