authorgravatar for 122468993+JonasFocus@users.noreply.github.comJonas B. <122468993+JonasFocus@users.noreply.github.com> 2026-10-11 20:14:09-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-12 01:14:09+00:00
loga5331e4c2c0f0a7b85d912e487f5c97bbce921aa
tree365a9798c605b370a89adcdbd2ff82d5de954232
parent63eaa79242ccb591b7933335cfb758d065952f53
signature Signed by PGP key B5690EEEBB952194

fix(server): checkpoint restore keeps a nested workspace on Windows (#14874)


2 files changed, 5 insertions(+), 1 deletions(-)

apps/server/src/vcs/GitVcsDriver.test.ts+1
...@@ -1049,6 +1049,7 @@ it.effect("restores empty checkpoints without changing paths outside the workspa...@@ -1049,6 +1049,7 @@ it.effect("restores empty checkpoints without changing paths outside the workspa
1049 fallbackToHead: false,1049 fallbackToHead: false,
1050 }),1050 }),
1051 );1051 );
1052 assert.isTrue(yield* fileSystem.exists(cwd));
1052 assert.isFalse(yield* fileSystem.exists(addedPath));1053 assert.isFalse(yield* fileSystem.exists(addedPath));
1053 }1054 }
1054 yield* fileSystem.writeFileString(1055 yield* fileSystem.writeFileString(
apps/server/src/vcs/GitVcsDriver.ts+4-1
...@@ -1114,7 +1114,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (...@@ -1114,7 +1114,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
1114 });1114 });
1115 }1115 }
1116 // Restoring away the last tracked file can remove a nested workspace directory.1116 // Restoring away the last tracked file can remove a nested workspace directory.
1117 yield* fileSystem.makeDirectory(input.cwd, { recursive: true }).pipe(1117 const recreateWorkspace = fileSystem.makeDirectory(input.cwd, { recursive: true }).pipe(
1118 Effect.mapError(1118 Effect.mapError(
1119 (cause) =>1119 (cause) =>
1120 new VcsProcessExitError({1120 new VcsProcessExitError({
...@@ -1126,6 +1126,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (...@@ -1126,6 +1126,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
1126 }),1126 }),
1127 ),1127 ),
1128 );1128 );
1129 yield* recreateWorkspace;
1129 const cleaned = yield* execute({1130 const cleaned = yield* execute({
1130 operation,1131 operation,
1131 cwd: input.cwd,1132 cwd: input.cwd,
...@@ -1150,6 +1151,8 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (...@@ -1150,6 +1151,8 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
1150 detail: cleaned.stderr.trim() || "Could not clean the checkpoint workspace.",1151 detail: cleaned.stderr.trim() || "Could not clean the checkpoint workspace.",
1151 });1152 });
1152 }1153 }
1154 // On Windows the same clean can remove './' and exit 0.
1155 yield* recreateWorkspace;
11531156
1154 const headExists = yield* hasHeadCommit(input.cwd);1157 const headExists = yield* hasHeadCommit(input.cwd);
1155 if (headExists) {1158 if (headExists) {