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.
This commit is contained in:
Martin von Zweigbergk 2024-03-10 14:13:57 -07:00 committed by Martin von Zweigbergk
parent 4d42604913
commit 7f101c4023

View file

@ -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(())
}