From 7f101c4023224894401bfdca3836f46a9e56b10b Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sun, 10 Mar 2024 14:13:57 -0700 Subject: [PATCH] move: don't use transient commit in operation description The `destination` variable we use when creating the operation log may have been replaced earlier in the code. I think this was a regression when I moved the setting of the description from `start_transaction()` to `finish_transaction()` a while ago. --- cli/src/commands/move.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cli/src/commands/move.rs b/cli/src/commands/move.rs index c22d153cf..af096c3f1 100644 --- a/cli/src/commands/move.rs +++ b/cli/src/commands/move.rs @@ -76,6 +76,11 @@ pub(crate) fn cmd_move( let diff_selector = workspace_command.diff_selector(ui, args.tool.as_deref(), args.interactive)?; let mut tx = workspace_command.start_transaction(); + let tx_description = format!( + "move changes from {} to {}", + source.id().hex(), + destination.id().hex() + ); let parent_tree = merge_commit_trees(tx.repo(), &source.parents())?; let source_tree = source.tree()?; let instructions = format!( @@ -141,13 +146,6 @@ from the source will be moved into the destination. .set_tree_id(new_destination_tree.id().clone()) .set_description(description) .write()?; - tx.finish( - ui, - format!( - "move changes from {} to {}", - source.id().hex(), - destination.id().hex() - ), - )?; + tx.finish(ui, tx_description)?; Ok(()) }