···199199 }
200200 }
201201 num_rebased += tx.mut_repo().rebase_descendants(command.settings())?;
202202+ if args.no_edit {
203203+ write!(ui.stderr(), "Created new commit ")?;
204204+ tx.write_commit_summary(ui.stderr_formatter().as_mut(), &new_commit)?;
205205+ writeln!(ui.stderr())?;
206206+ } else {
207207+ tx.edit(&new_commit).unwrap();
208208+ // The description of the new commit will be printed by tx.finish()
209209+ }
202210 if num_rebased > 0 {
203211 writeln!(ui.stderr(), "Rebased {num_rebased} descendant commits")?;
204204- }
205205- if !args.no_edit {
206206- tx.edit(&new_commit).unwrap();
207212 }
208213 tx.finish(ui)?;
209214 Ok(())
+3-3
cli/tests/test_new_command.rs
···9595 // Same test with `--no-edit`
9696 test_env.jj_cmd_ok(&repo_path, &["undo"]);
9797 let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["new", "main", "@", "--no-edit"]);
9898- // TODO(ilyagr): In this situation, `new` should probably report the identity of
9999- // the newly created commit.
10098 insta::assert_snapshot!(stdout, @"");
101101- insta::assert_snapshot!(stderr, @"");
9999+ insta::assert_snapshot!(stderr, @r###"
100100+ Created new commit znkkpsqq 200ed1a1 (empty) (no description set)
101101+ "###);
102102 insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
103103 ◉ 200ed1a14c8acf09783dafefe5bebf2ff58f12fd
104104 ├─╮