From 7d50ebc23efb80a12ca280dc89c55f64738cb4fe Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sat, 20 Jul 2024 17:06:13 +0900 Subject: [PATCH] cli: commit: set up rewritten commit early For the same reason as the previous commit. --- cli/src/commands/commit.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/cli/src/commands/commit.rs b/cli/src/commands/commit.rs index 6ec05a903..785fce78e 100644 --- a/cli/src/commands/commit.rs +++ b/cli/src/commands/commit.rs @@ -98,6 +98,15 @@ new working-copy commit. )?; } + let mut commit_builder = tx + .mut_repo() + .rewrite_commit(command.settings(), &commit) + .detach(); + commit_builder.set_tree_id(tree_id); + if args.reset_author { + commit_builder.set_author(commit_builder.committer().clone()); + } + let template = description_template_for_commit( ui, command.settings(), @@ -113,17 +122,9 @@ new working-copy commit. } else { edit_description(tx.base_repo(), &template, command.settings())? }; + commit_builder.set_description(description); + let new_commit = commit_builder.write(tx.mut_repo())?; - let mut commit_builder = tx - .mut_repo() - .rewrite_commit(command.settings(), &commit) - .set_tree_id(tree_id) - .set_description(description); - if args.reset_author { - let new_author = commit_builder.committer().clone(); - commit_builder = commit_builder.set_author(new_author); - } - let new_commit = commit_builder.write()?; let workspace_ids = tx .mut_repo() .view()