Revert "Disable checkpoints on Windows"

This commit is contained in:
Matt Rubens 2025-02-11 10:19:49 -05:00 committed by GitHub
parent 43d4c5c167
commit 06ba6606c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 42 deletions

View file

@ -143,7 +143,7 @@ export class Cline {
this.fuzzyMatchThreshold = fuzzyMatchThreshold ?? 1.0
this.providerRef = new WeakRef(provider)
this.diffViewProvider = new DiffViewProvider(cwd)
this.checkpointsEnabled = process.platform !== "win32" && !!enableCheckpoints
this.checkpointsEnabled = enableCheckpoints ?? false
if (historyItem) {
this.taskId = historyItem.id
@ -3240,7 +3240,6 @@ export class Cline {
this.checkpointService = await CheckpointService.create({
taskId: this.taskId,
baseDir: vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) ?? "",
log: (message) => this.providerRef.deref()?.log(message),
})
}

View file

@ -2,6 +2,7 @@ import fs from "fs/promises"
import { existsSync } from "fs"
import path from "path"
import debug from "debug"
import simpleGit, { SimpleGit, CleanOptions } from "simple-git"
export type CheckpointServiceOptions = {
@ -312,11 +313,15 @@ export class CheckpointService {
}
public static async create({ taskId, git, baseDir, log = console.log }: CheckpointServiceOptions) {
if (process.platform === "win32") {
throw new Error("Checkpoints are not supported on Windows.")
}
git = git || simpleGit({ baseDir })
git =
git ||
simpleGit({
baseDir,
binary: "git",
maxConcurrentProcesses: 1,
config: [],
trimmed: true,
})
const version = await git.version()

View file

@ -14,7 +14,6 @@ describe("CheckpointService", () => {
let git: SimpleGit
let testFile: string
let service: CheckpointService
let originalPlatform: string
const initRepo = async ({
baseDir,
@ -49,19 +48,6 @@ describe("CheckpointService", () => {
return { git, testFile }
}
beforeAll(() => {
originalPlatform = process.platform
Object.defineProperty(process, "platform", {
value: "darwin",
})
})
afterAll(() => {
Object.defineProperty(process, "platform", {
value: originalPlatform,
})
})
beforeEach(async () => {
const baseDir = path.join(os.tmpdir(), `checkpoint-service-test-${Date.now()}`)
const repo = await initRepo({ baseDir })

View file

@ -701,29 +701,27 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
</div>
)}
{process.platform !== "win32" && (
<div style={{ marginBottom: 15 }}>
<div style={{ display: "flex", alignItems: "center", gap: "5px" }}>
<span style={{ color: "var(--vscode-errorForeground)" }}></span>
<VSCodeCheckbox
checked={checkpointsEnabled}
onChange={(e: any) => {
setCheckpointsEnabled(e.target.checked)
}}>
<span style={{ fontWeight: "500" }}>Enable experimental checkpoints</span>
</VSCodeCheckbox>
</div>
<p
style={{
fontSize: "12px",
marginTop: "5px",
color: "var(--vscode-descriptionForeground)",
<div style={{ marginBottom: 15 }}>
<div style={{ display: "flex", alignItems: "center", gap: "5px" }}>
<span style={{ color: "var(--vscode-errorForeground)" }}></span>
<VSCodeCheckbox
checked={checkpointsEnabled}
onChange={(e: any) => {
setCheckpointsEnabled(e.target.checked)
}}>
When enabled, Roo will save a checkpoint whenever a file in the workspace is
modified, added or deleted, letting you easily revert to a previous state.
</p>
<span style={{ fontWeight: "500" }}>Enable experimental checkpoints</span>
</VSCodeCheckbox>
</div>
)}
<p
style={{
fontSize: "12px",
marginTop: "5px",
color: "var(--vscode-descriptionForeground)",
}}>
When enabled, Roo will save a checkpoint whenever a file in the workspace is modified,
added or deleted, letting you easily revert to a previous state.
</p>
</div>
{Object.entries(experimentConfigsMap)
.filter((config) => config[0] !== "DIFF_STRATEGY")