From ec4bb4ffa3c14ee937941c1188da191826895ee0 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Fri, 9 Feb 2024 01:00:44 -0800 Subject: [PATCH] workspace: create transaction using workspace_command Using workspace_command means that we record the command arguments into the ops log. This also allows us to avoid a clone of an Arc. --- cli/src/commands/workspace.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/src/commands/workspace.rs b/cli/src/commands/workspace.rs index 60fe7a6e5..82fd97cc1 100644 --- a/cli/src/commands/workspace.rs +++ b/cli/src/commands/workspace.rs @@ -288,13 +288,13 @@ fn create_and_check_out_recovery_commit( ) -> Result, CommandError> { let mut workspace_command = command.workspace_helper_no_snapshot(ui)?; let workspace_id = workspace_command.workspace_id().clone(); - let repo = workspace_command.repo().clone(); - let tree_id = repo.store().empty_merged_tree_id(); + let mut tx = workspace_command.start_transaction().into_inner(); + + let tree_id = workspace_command.repo().store().empty_merged_tree_id(); let (mut locked_workspace, commit) = workspace_command.unchecked_start_working_copy_mutation()?; let commit_id = commit.id(); - let mut tx = repo.start_transaction(command.settings()); let mut_repo = tx.mut_repo(); let new_commit = mut_repo .new_commit(command.settings(), vec![commit_id.clone()], tree_id.clone())