Skip to content

Commit 896cf9d

Browse files
committed
fix(windows): use GIT_WORK_TREE for ShadowCheckpointService to avoid core.worktree invalid work tree config
1 parent 39cf881 commit 896cf9d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/services/checkpoints/ShadowCheckpointService.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ export abstract class ShadowCheckpointService extends EventEmitter {
7777
}
7878

7979
await fs.mkdir(this.checkpointsDir, { recursive: true })
80-
const git = simpleGit(this.workspaceDir, { binary: "git" }).env("GIT_DIR", this.dotGitDir)
80+
const git = simpleGit(this.workspaceDir, { binary: "git" })
81+
.env("GIT_DIR", this.dotGitDir)
82+
.env("GIT_WORK_TREE", this.workspaceDir)
8183
const gitVersion = await git.version()
8284
this.log(`[${this.constructor.name}#create] git = ${gitVersion}`)
8385

@@ -123,7 +125,7 @@ export abstract class ShadowCheckpointService extends EventEmitter {
123125
} else {
124126
this.log(`[${this.constructor.name}#initShadowGit] creating shadow git repo at ${this.checkpointsDir}`)
125127
await git.init()
126-
await git.addConfig("core.worktree", this.workspaceDir) // Sets the working tree to the current workspace.
128+
// Use GIT_WORK_TREE environment (set on the git instance) instead of core.worktree to avoid platform-specific issues
127129
await git.addConfig("commit.gpgSign", "false") // Disable commit signing for shadow repo.
128130
await git.addConfig("user.name", "Roo Code")
129131
await git.addConfig("user.email", "[email protected]")

src/services/file-changes/FCOMessageHandler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class FCOMessageHandler {
3535
* Handle FCO-specific messages
3636
*/
3737
public async handleMessage(message: WebviewMessage): Promise<void> {
38-
const task = this.provider.getCurrentCline()
38+
const task = this.provider.getCurrentTask()
3939

4040
switch (message.type) {
4141
case "webviewReady": {
@@ -206,7 +206,7 @@ export class FCOMessageHandler {
206206
}
207207

208208
// Get the current task and checkpoint service
209-
const currentTask = this.provider.getCurrentCline()
209+
const currentTask = this.provider.getCurrentTask()
210210
if (!currentTask) {
211211
console.error(`[FCO] No current task found for file reversion`)
212212
return
@@ -278,7 +278,7 @@ export class FCOMessageHandler {
278278
: changeset.files
279279

280280
// Get the current task and checkpoint service
281-
const currentTask = this.provider.getCurrentCline()
281+
const currentTask = this.provider.getCurrentTask()
282282
if (!currentTask) {
283283
console.error(`[FCO] No current task found for file reversion`)
284284
return

0 commit comments

Comments
 (0)