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
This commit is contained in:
Roo Code 2025-08-19 14:12:15 +00:00
parent 532728ee85
commit dfe4b820f2

View file

@ -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"])