mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-20 03:20:08 +00:00
cli: commit, split: set default description to intermediate commit object
description_template_for_*() functions will be merged soon. We don't need to set the default description to the second commit of the split because its description should be kept empty if it was.
This commit is contained in:
parent
6395d32358
commit
45d16f4b34
3 changed files with 9 additions and 15 deletions
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue