diff --git a/cli/src/commands/commit.rs b/cli/src/commands/commit.rs index abbf800f6e..fa1b803775 100644 --- a/cli/src/commands/commit.rs +++ b/cli/src/commands/commit.rs @@ -109,14 +109,12 @@ new working-copy commit. let description = if !args.message_paragraphs.is_empty() { join_message_paragraphs(&args.message_paragraphs) } else { + if commit_builder.description().is_empty() { + commit_builder.set_description(command.settings().default_description()); + } let temp_commit = commit_builder.write_hidden()?; - let template = description_template_for_commit( - ui, - command.settings(), - tx.base_workspace_helper(), - "", - &temp_commit, - )?; + let template = + description_template_for_commit(ui, tx.base_workspace_helper(), "", &temp_commit)?; edit_description(tx.base_repo(), &template, command.settings())? }; commit_builder.set_description(description); diff --git a/cli/src/commands/split.rs b/cli/src/commands/split.rs index 002cbe70c1..3dda7051dc 100644 --- a/cli/src/commands/split.rs +++ b/cli/src/commands/split.rs @@ -128,10 +128,12 @@ the operation will be aborted. .rewrite_commit(command.settings(), &commit) .detach(); commit_builder.set_tree_id(selected_tree_id); + if commit_builder.description().is_empty() { + commit_builder.set_description(command.settings().default_description()); + } let temp_commit = commit_builder.write_hidden()?; let template = description_template_for_commit( ui, - command.settings(), tx.base_workspace_helper(), "Enter a description for the first commit.", &temp_commit, @@ -175,7 +177,6 @@ the operation will be aborted. let temp_commit = commit_builder.write_hidden()?; let template = description_template_for_commit( ui, - command.settings(), tx.base_workspace_helper(), "Enter a description for the second commit.", &temp_commit, diff --git a/cli/src/description_util.rs b/cli/src/description_util.rs index c6f1b907ce..b2ce716a55 100644 --- a/cli/src/description_util.rs +++ b/cli/src/description_util.rs @@ -112,7 +112,6 @@ pub fn description_template_for_describe( pub fn description_template_for_commit( ui: &Ui, - settings: &UserSettings, workspace_command: &WorkspaceCommandHelper, intro: &str, commit: &Commit, @@ -129,11 +128,7 @@ pub fn description_template_for_commit( if !intro.is_empty() { template_chunks.push(format!("JJ: {intro}\n")); } - template_chunks.push(if commit.description().is_empty() { - settings.default_description() - } else { - commit.description().to_owned() - }); + template_chunks.push(commit.description().to_owned()); if !diff_summary_bytes.is_empty() { template_chunks.push("\n".to_owned()); template_chunks.push(diff_summary_to_description(&diff_summary_bytes));