Skip to content

Commit 49b9a62

Browse files
committed
Eliminate the dedicated workspace copy action and remove explicit directory cleanup from workspace synchronization routines
1 parent 74d8b94 commit 49b9a62

5 files changed

Lines changed: 15 additions & 84 deletions

File tree

packages/vscode/src/commands/checkpoints-command/actions/copy-workspace-to-dir.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/vscode/src/commands/checkpoints-command/actions/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export * from './copy-workspace-to-dir'
21
export * from './create-checkpoint'
32
export * from './create-temporary-checkpoint'
43
export * from './delete-checkpoint'

packages/vscode/src/commands/checkpoints-command/actions/restore-checkpoint.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { Checkpoint } from '../types'
55
import { create_temporary_checkpoint } from './create-temporary-checkpoint'
66
import { delete_checkpoint } from './delete-checkpoint'
77
import { sync_workspace_from_dir } from './sync-workspace-from-dir'
8-
import { get_checkpoint_path } from '../utils'
8+
import { get_checkpoint_path, sync_directory } from '../utils'
99
import { apply_git_diff } from '../utils/git-utils'
1010
import * as path from 'path'
1111

@@ -103,10 +103,19 @@ export const restore_checkpoint = async (params: {
103103
throw err
104104
}
105105
} else {
106-
await sync_workspace_from_dir({
107-
source_dir_uri: checkpoint_dir_uri,
108-
workspace_provider: params.workspace_provider
109-
})
106+
const source_folder_uri =
107+
workspace_folders.length > 1
108+
? vscode.Uri.joinPath(checkpoint_dir_uri, folder.name)
109+
: checkpoint_dir_uri
110+
try {
111+
await vscode.workspace.fs.stat(source_folder_uri)
112+
await sync_directory({
113+
source_dir: source_folder_uri,
114+
dest_dir: folder.uri,
115+
root_path: folder.uri.fsPath,
116+
workspace_provider: params.workspace_provider
117+
})
118+
} catch {}
110119
}
111120
}
112121
} else {

packages/vscode/src/commands/checkpoints-command/actions/sync-workspace-from-dir.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as vscode from 'vscode'
22
import { WorkspaceProvider } from '../../../context/providers/workspace-provider'
3-
import { clean_directory, sync_directory } from '../utils'
3+
import { sync_directory } from '../utils'
44

55
export const sync_workspace_from_dir = async (params: {
66
source_dir_uri: vscode.Uri
@@ -27,11 +27,6 @@ export const sync_workspace_from_dir = async (params: {
2727
workspace_provider: params.workspace_provider
2828
})
2929
} else {
30-
await clean_directory({
31-
dir_uri: folder.uri,
32-
root_path: folder.uri.fsPath,
33-
workspace_provider: params.workspace_provider
34-
})
3530
}
3631
}
3732
} else {

packages/vscode/src/commands/checkpoints-command/utils/clean-directory.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)