fix(windows): use GIT_WORK_TREE for ShadowCheckpointService to avoid core.worktree invalid work tree config

This commit is contained in:
Hannes Rudolph 2025-08-27 16:04:25 -06:00
parent 39cf881838
commit 896cf9df44
2 changed files with 7 additions and 5 deletions

View file

@ -77,7 +77,9 @@ export abstract class ShadowCheckpointService extends EventEmitter {
}
await fs.mkdir(this.checkpointsDir, { recursive: true })
const git = simpleGit(this.workspaceDir, { binary: "git" }).env("GIT_DIR", this.dotGitDir)
const git = simpleGit(this.workspaceDir, { binary: "git" })
.env("GIT_DIR", this.dotGitDir)
.env("GIT_WORK_TREE", this.workspaceDir)
const gitVersion = await git.version()
this.log(`[${this.constructor.name}#create] git = ${gitVersion}`)
@ -123,7 +125,7 @@ export abstract class ShadowCheckpointService extends EventEmitter {
} else {
this.log(`[${this.constructor.name}#initShadowGit] creating shadow git repo at ${this.checkpointsDir}`)
await git.init()
await git.addConfig("core.worktree", this.workspaceDir) // Sets the working tree to the current workspace.
// Use GIT_WORK_TREE environment (set on the git instance) instead of core.worktree to avoid platform-specific issues
await git.addConfig("commit.gpgSign", "false") // Disable commit signing for shadow repo.
await git.addConfig("user.name", "Roo Code")
await git.addConfig("user.email", "noreply@example.com")

View file

@ -35,7 +35,7 @@ export class FCOMessageHandler {
* Handle FCO-specific messages
*/
public async handleMessage(message: WebviewMessage): Promise<void> {
const task = this.provider.getCurrentCline()
const task = this.provider.getCurrentTask()
switch (message.type) {
case "webviewReady": {
@ -206,7 +206,7 @@ export class FCOMessageHandler {
}
// Get the current task and checkpoint service
const currentTask = this.provider.getCurrentCline()
const currentTask = this.provider.getCurrentTask()
if (!currentTask) {
console.error(`[FCO] No current task found for file reversion`)
return
@ -278,7 +278,7 @@ export class FCOMessageHandler {
: changeset.files
// Get the current task and checkpoint service
const currentTask = this.provider.getCurrentCline()
const currentTask = this.provider.getCurrentTask()
if (!currentTask) {
console.error(`[FCO] No current task found for file reversion`)
return