Skip to content

Commit 359881a

Browse files
committed
Consolidate commit checkpoint creation logic into the dedicated handle_accept_commit_message handler
1 parent 8957532 commit 359881a

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

‎packages/vscode/src/views/panel/backend/message-handlers/handle-accept-commit-message.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { LAST_APPLIED_CHANGES_STATE_KEY } from '@/constants/state-keys'
55
import { get_git_repository } from '@/utils/git-repository-utils'
66
import { dictionary } from '@shared/constants/dictionary'
77
import { PanelProvider } from '@/views/panel/backend/panel-provider'
8+
import { create_checkpoint } from '@/commands/checkpoints-command/actions'
89

910
export const handle_accept_commit_message = async (
1011
panel_provider: PanelProvider,
@@ -25,6 +26,15 @@ export const handle_accept_commit_message = async (
2526
panel_provider.set_undo_button_state(false)
2627

2728
await repository.status()
29+
30+
const title = 'Committed changes'
31+
const description = commit_message
32+
await create_checkpoint(
33+
panel_provider.workspace_provider,
34+
panel_provider.context,
35+
title,
36+
description
37+
)
2838
} catch (commit_error) {
2939
Logger.error({
3040
function_name: 'handle_accept_commit_message',

‎packages/vscode/src/views/panel/backend/panel-provider.ts‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ import { Logger } from '@shared/utils/logger'
8989
import { CancelTokenSource } from 'axios'
9090
import { update_last_used_preset_or_group } from './message-handlers/update-last-used-preset-or-group'
9191
import { undo_files } from '@/commands/apply-chat-response-command/utils/file-operations'
92-
import { create_checkpoint } from '@/commands/checkpoints-command/actions'
9392
import { dictionary } from '@shared/constants/dictionary'
9493

9594
export class PanelProvider implements vscode.WebviewViewProvider {
@@ -547,16 +546,6 @@ export class PanelProvider implements vscode.WebviewViewProvider {
547546
await handle_proceed_with_commit(this, message.files_to_stage)
548547
} else if (message.command == 'ACCEPT_COMMIT_MESSAGE') {
549548
await handle_accept_commit_message(this, message.commit_message)
550-
551-
const title = 'Committed changes'
552-
const description = message.commit_message
553-
554-
await create_checkpoint(
555-
this.workspace_provider,
556-
this.context,
557-
title,
558-
description
559-
)
560549
} else if (message.command == 'CANCEL_COMMIT_MESSAGE') {
561550
await handle_cancel_commit_message(this)
562551
} else if (message.command == 'MANAGE_CONFIGURATIONS') {

0 commit comments

Comments
 (0)