cli describe: move use_editor variable closer to use sites

This commit is contained in:
Vincent Ging Ho Yim 2025-05-18 00:05:12 +10:00
parent 12c1a552cd
commit 459ed85f62

View File

@ -152,11 +152,6 @@ pub(crate) fn cmd_describe(
None
};
// edit and no_edit are conflicting arguments and therefore it should not
// be possible for both to be true at the same time.
assert!(!(args.edit && args.no_edit));
let use_editor = args.edit || (shared_description.is_none() && !args.no_edit);
let mut commit_builders = commits
.iter()
.map(|commit| {
@ -180,6 +175,11 @@ pub(crate) fn cmd_describe(
})
.collect_vec();
// edit and no_edit are conflicting arguments and therefore it should not
// be possible for both to be true at the same time.
assert!(!(args.edit && args.no_edit));
let use_editor = args.edit || (shared_description.is_none() && !args.no_edit);
if let Some(trailer_template) = parse_trailers_template(ui, &tx)? {
for commit_builder in &mut commit_builders {
// The first trailer would become the first line of the description.