Skip to content

Commit a5331e4

Browse files
authored
fix(server): checkpoint restore keeps a nested workspace on Windows (#14874)
1 parent 63eaa79 commit a5331e4

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,7 @@ it.effect("restores empty checkpoints without changing paths outside the workspa
10491049
fallbackToHead: false,
10501050
}),
10511051
);
1052+
assert.isTrue(yield* fileSystem.exists(cwd));
10521053
assert.isFalse(yield* fileSystem.exists(addedPath));
10531054
}
10541055
yield* fileSystem.writeFileString(

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
11141114
});
11151115
}
11161116
// 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(
11181118
Effect.mapError(
11191119
(cause) =>
11201120
new VcsProcessExitError({
@@ -1126,6 +1126,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
11261126
}),
11271127
),
11281128
);
1129+
yield* recreateWorkspace;
11291130
const cleaned = yield* execute({
11301131
operation,
11311132
cwd: input.cwd,
@@ -1150,6 +1151,8 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
11501151
detail: cleaned.stderr.trim() || "Could not clean the checkpoint workspace.",
11511152
});
11521153
}
1154+
// On Windows the same clean can remove './' and exit 0.
1155+
yield* recreateWorkspace;
11531156

11541157
const headExists = yield* hasHeadCommit(input.cwd);
11551158
if (headExists) {

0 commit comments

Comments
 (0)