Skip to content

Commit cbf47aa

Browse files
authored
Merge pull request #914 from RooVetGit/cte/disable-checkpoints-on-windows
Disable checkpoints on Windows
2 parents 60ea3c2 + 3aed7d1 commit cbf47aa

File tree

4 files changed

+42
-30
lines changed

4 files changed

+42
-30
lines changed

src/core/Cline.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class Cline {
143143
this.fuzzyMatchThreshold = fuzzyMatchThreshold ?? 1.0
144144
this.providerRef = new WeakRef(provider)
145145
this.diffViewProvider = new DiffViewProvider(cwd)
146-
this.checkpointsEnabled = enableCheckpoints ?? false
146+
this.checkpointsEnabled = process.platform !== "win32" && !!enableCheckpoints
147147

148148
if (historyItem) {
149149
this.taskId = historyItem.id
@@ -3240,6 +3240,7 @@ export class Cline {
32403240
this.checkpointService = await CheckpointService.create({
32413241
taskId: this.taskId,
32423242
baseDir: vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) ?? "",
3243+
log: (message) => this.providerRef.deref()?.log(message),
32433244
})
32443245
}
32453246

src/services/checkpoints/CheckpointService.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import fs from "fs/promises"
22
import { existsSync } from "fs"
33
import path from "path"
44

5-
import debug from "debug"
65
import simpleGit, { SimpleGit, CleanOptions } from "simple-git"
76

87
export type CheckpointServiceOptions = {
@@ -246,15 +245,11 @@ export class CheckpointService {
246245
}
247246

248247
public static async create({ taskId, git, baseDir, log = console.log }: CheckpointServiceOptions) {
249-
git =
250-
git ||
251-
simpleGit({
252-
baseDir,
253-
binary: "git",
254-
maxConcurrentProcesses: 1,
255-
config: [],
256-
trimmed: true,
257-
})
248+
if (process.platform === "win32") {
249+
throw new Error("Checkpoints are not supported on Windows.")
250+
}
251+
252+
git = git || simpleGit({ baseDir })
258253

259254
const version = await git.version()
260255

src/services/checkpoints/__tests__/CheckpointService.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ describe("CheckpointService", () => {
1414
let git: SimpleGit
1515
let testFile: string
1616
let service: CheckpointService
17+
let originalPlatform: string
1718

1819
const initRepo = async ({
1920
baseDir,
@@ -48,6 +49,19 @@ describe("CheckpointService", () => {
4849
return { git, testFile }
4950
}
5051

52+
beforeAll(() => {
53+
originalPlatform = process.platform
54+
Object.defineProperty(process, "platform", {
55+
value: "darwin",
56+
})
57+
})
58+
59+
afterAll(() => {
60+
Object.defineProperty(process, "platform", {
61+
value: originalPlatform,
62+
})
63+
})
64+
5165
beforeEach(async () => {
5266
const baseDir = path.join(os.tmpdir(), `checkpoint-service-test-${Date.now()}`)
5367
const repo = await initRepo({ baseDir })

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -701,27 +701,29 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
701701
</div>
702702
)}
703703

704-
<div style={{ marginBottom: 15 }}>
705-
<div style={{ display: "flex", alignItems: "center", gap: "5px" }}>
706-
<span style={{ color: "var(--vscode-errorForeground)" }}>⚠️</span>
707-
<VSCodeCheckbox
708-
checked={checkpointsEnabled}
709-
onChange={(e: any) => {
710-
setCheckpointsEnabled(e.target.checked)
704+
{process.platform !== "win32" && (
705+
<div style={{ marginBottom: 15 }}>
706+
<div style={{ display: "flex", alignItems: "center", gap: "5px" }}>
707+
<span style={{ color: "var(--vscode-errorForeground)" }}>⚠️</span>
708+
<VSCodeCheckbox
709+
checked={checkpointsEnabled}
710+
onChange={(e: any) => {
711+
setCheckpointsEnabled(e.target.checked)
712+
}}>
713+
<span style={{ fontWeight: "500" }}>Enable experimental checkpoints</span>
714+
</VSCodeCheckbox>
715+
</div>
716+
<p
717+
style={{
718+
fontSize: "12px",
719+
marginTop: "5px",
720+
color: "var(--vscode-descriptionForeground)",
711721
}}>
712-
<span style={{ fontWeight: "500" }}>Enable experimental checkpoints</span>
713-
</VSCodeCheckbox>
722+
When enabled, Roo will save a checkpoint whenever a file in the workspace is
723+
modified, added or deleted, letting you easily revert to a previous state.
724+
</p>
714725
</div>
715-
<p
716-
style={{
717-
fontSize: "12px",
718-
marginTop: "5px",
719-
color: "var(--vscode-descriptionForeground)",
720-
}}>
721-
When enabled, Roo will save a checkpoint whenever a file in the workspace is modified,
722-
added or deleted, letting you easily revert to a previous state.
723-
</p>
724-
</div>
726+
)}
725727

726728
{Object.entries(experimentConfigsMap)
727729
.filter((config) => config[0] !== "DIFF_STRATEGY")

0 commit comments

Comments
 (0)