From dfe4b820f24968cd5806d1a94c8ded38aa877f64 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 19 Aug 2025 14:12:15 +0000 Subject: [PATCH] fix: prevent nul file creation on Windows during checkpoint restore - Replace simple-git clean() method calls with raw git commands - The simple-git clean() method was incorrectly interpreting the mode parameter - On Windows, this could create reserved filenames like "nul" - Using git.raw(["clean", "-fd"]) directly avoids this issue Fixes #7216 --- src/services/checkpoints/ShadowCheckpointService.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/checkpoints/ShadowCheckpointService.ts b/src/services/checkpoints/ShadowCheckpointService.ts index 03e019ed60..55d161183b 100644 --- a/src/services/checkpoints/ShadowCheckpointService.ts +++ b/src/services/checkpoints/ShadowCheckpointService.ts @@ -250,7 +250,8 @@ export abstract class ShadowCheckpointService extends EventEmitter { } const start = Date.now() - await this.git.clean("f", ["-d", "-f"]) + // Use raw git command to avoid issues with simple-git's clean method on Windows + await this.git.raw(["clean", "-fd"]) await this.git.reset(["--hard", commitHash]) // Remove all checkpoints after the specified commitHash. @@ -384,7 +385,8 @@ export abstract class ShadowCheckpointService extends EventEmitter { try { await git.raw(["config", "--unset", "core.worktree"]) await git.reset(["--hard"]) - await git.clean("f", ["-d"]) + // Use raw git command to avoid issues with simple-git's clean method on Windows + await git.raw(["clean", "-fd"]) const defaultBranch = branches.all.includes("main") ? "main" : "master" await git.checkout([defaultBranch, "--force"])