Skip to content

Commit d63fc8a

Browse files
committed
fix(server): isolate temporary split-index commands
1 parent a311323 commit d63fc8a

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
908908
yield* writeTextFile(cwd, "before.ts", "one\ntwo\nthree\nfour\nfive\n");
909909
yield* git(cwd, ["add", "before.ts"]);
910910
yield* git(cwd, ["commit", "-m", "add source file"]);
911+
yield* git(cwd, ["config", "core.splitIndex", "true"]);
911912
yield* git(cwd, ["config", "splitIndex.sharedIndexExpire", "now"]);
912913
yield* git(cwd, ["update-index", "--split-index"]);
913914
const indexPath = yield* git(cwd, ["rev-parse", "--git-path", "index"]);

‎apps/server/src/vcs/GitVcsDriverCore.ts‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,22 +2336,35 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
23362336
});
23372337
yield* fileSystem.copyFile(indexPath, tempIndexPath);
23382338
const env = { GIT_INDEX_FILE: tempIndexPath } satisfies NodeJS.ProcessEnv;
2339+
const tempIndexConfig = [
2340+
"-c",
2341+
"core.splitIndex=false",
2342+
"-c",
2343+
"splitIndex.sharedIndexExpire=never",
2344+
];
23392345
yield* executeGit(
23402346
"GitVcsDriver.readUnifiedWorkingTreeReviewDiff.expandSplitIndex",
23412347
cwd,
2342-
["-c", "splitIndex.sharedIndexExpire=never", "update-index", "--no-split-index"],
2348+
[...tempIndexConfig, "update-index", "--no-split-index"],
23432349
{ env },
23442350
);
23452351
yield* executeGit(
23462352
"GitVcsDriver.readUnifiedWorkingTreeReviewDiff.addUntracked",
23472353
cwd,
2348-
["add", "--intent-to-add", "--pathspec-from-file=-", "--pathspec-file-nul"],
2354+
[
2355+
...tempIndexConfig,
2356+
"add",
2357+
"--intent-to-add",
2358+
"--pathspec-from-file=-",
2359+
"--pathspec-file-nul",
2360+
],
23492361
{ env, stdin: `${pathsToAdd.join("\0")}\0` },
23502362
);
23512363
const result = yield* executeGit(
23522364
"GitVcsDriver.readUnifiedWorkingTreeReviewDiff.diff",
23532365
cwd,
23542366
[
2367+
...tempIndexConfig,
23552368
"diff",
23562369
"--patch",
23572370
"--no-color",

0 commit comments

Comments
 (0)