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 21, 18:30 UTC
fix(server): Changes totals no longer take index.lock (#35770)
Julius Marminge committed
Nov 12, 2026 at 17:47 UTC
f5d0be65fecc63d31f8bf0fc2151d2f2ec666524
2 files changed
+25
-1
apps/server/src/vcs/GitVcsDriverCore.test.ts
+23
@@ -4017,6 +4017,29 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
4017
}),
4018
);
4019
4020
+ it.effect("reads Changes totals without rewriting the real index for stat-dirty files", () =>
4021
+ Effect.gen(function* () {
4022
+ const cwd = yield* makeTmpDir();
4023
+ yield* initRepoWithCommit(cwd);
4024
+ const driver = yield* GitVcsDriver.GitVcsDriver;
4025
+ const fileSystem = yield* FileSystem.FileSystem;
4026
+ const path = yield* Path.Path;
4027
+ yield* writeTextFile(cwd, "tracked.txt", "same content\n");
4028
+ yield* git(cwd, ["add", "tracked.txt"]);
4029
+ yield* git(cwd, ["commit", "-m", "add tracked file"]);
4030
+ yield* fileSystem.utimes(path.join(cwd, "tracked.txt"), 1_000_000_000, 1_000_000_000);
4031
+ const indexPath = path.join(cwd, ".git", "index");
4032
+ const originalIndex = yield* fileSystem.readFile(indexPath);
4033
+
4034
+ const status = yield* driver.statusDetailsLocal(cwd, { includeBranchChanges: true });
4035
+
4036
+ assert.strictEqual(status.branchChanges?.insertions, 0);
4037
+ assert.strictEqual(status.branchChanges?.deletions, 0);
4038
+ // Writing the index takes index.lock, which makes concurrent user Git writes fail.
4039
+ assert.deepStrictEqual(yield* fileSystem.readFile(indexPath), originalIndex);
4040
+ }),
4041
+ );
4042
+
4043
it.effect("reads Changes totals with untracked files when requested", () =>
4044
Effect.gen(function* () {
4045
const cwd = yield* makeTmpDir();
apps/server/src/vcs/GitVcsDriverCore.ts
+2
-1
@@ -3513,7 +3513,8 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
3513
executeGit(
3514
"GitVcsDriver.readBranchChangeTotals",
3515
cwd,
3516
- [...REVIEW_DIFF_ARGS, "--numstat", "-z", ref, "--"],
3516
+ // Plumbing: porcelain diff refreshes and rewrites the real index, taking index.lock.
3517
+ ["diff-index", "-M", "--numstat", "-z", ref, "--"],
3518
{
3519
allowNonZeroExit: true,
3520
maxOutputBytes: REVIEW_METADATA_MAX_OUTPUT_BYTES,