diff --git a/apps/server/src/vcs/GitVcsDriver.test.ts b/apps/server/src/vcs/GitVcsDriver.test.ts index a6bbef6ed1de09e0efaf1488484b22f7dec8df42..3a7a16f95d4cca32c5159dba3c1dc17f8a3d33d2 100644 --- a/apps/server/src/vcs/GitVcsDriver.test.ts +++ b/apps/server/src/vcs/GitVcsDriver.test.ts @@ -1049,6 +1049,7 @@ it.effect("restores empty checkpoints without changing paths outside the workspa fallbackToHead: false, }), ); + assert.isTrue(yield* fileSystem.exists(cwd)); assert.isFalse(yield* fileSystem.exists(addedPath)); } yield* fileSystem.writeFileString( diff --git a/apps/server/src/vcs/GitVcsDriver.ts b/apps/server/src/vcs/GitVcsDriver.ts index 599269791edf1a11dbfc2cdfdd10a6b0033050ec..3803c78fc6d2e61e8bf0ce2eede04ee342493acf 100644 --- a/apps/server/src/vcs/GitVcsDriver.ts +++ b/apps/server/src/vcs/GitVcsDriver.ts @@ -1114,7 +1114,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* ( }); } // Restoring away the last tracked file can remove a nested workspace directory. - yield* fileSystem.makeDirectory(input.cwd, { recursive: true }).pipe( + const recreateWorkspace = fileSystem.makeDirectory(input.cwd, { recursive: true }).pipe( Effect.mapError( (cause) => new VcsProcessExitError({ @@ -1126,6 +1126,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* ( }), ), ); + yield* recreateWorkspace; const cleaned = yield* execute({ operation, cwd: input.cwd, @@ -1150,6 +1151,8 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* ( detail: cleaned.stderr.trim() || "Could not clean the checkpoint workspace.", }); } + // On Windows the same clean can remove './' and exit 0. + yield* recreateWorkspace; const headExists = yield* hasHeadCommit(input.cwd); if (headExists) {