just playing with tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cli new: have `--no-edit` print description of the new commit

+11 -6
+8 -3
cli/src/commands/new.rs
··· 199 199 } 200 200 } 201 201 num_rebased += tx.mut_repo().rebase_descendants(command.settings())?; 202 + if args.no_edit { 203 + write!(ui.stderr(), "Created new commit ")?; 204 + tx.write_commit_summary(ui.stderr_formatter().as_mut(), &new_commit)?; 205 + writeln!(ui.stderr())?; 206 + } else { 207 + tx.edit(&new_commit).unwrap(); 208 + // The description of the new commit will be printed by tx.finish() 209 + } 202 210 if num_rebased > 0 { 203 211 writeln!(ui.stderr(), "Rebased {num_rebased} descendant commits")?; 204 - } 205 - if !args.no_edit { 206 - tx.edit(&new_commit).unwrap(); 207 212 } 208 213 tx.finish(ui)?; 209 214 Ok(())
+3 -3
cli/tests/test_new_command.rs
··· 95 95 // Same test with `--no-edit` 96 96 test_env.jj_cmd_ok(&repo_path, &["undo"]); 97 97 let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["new", "main", "@", "--no-edit"]); 98 - // TODO(ilyagr): In this situation, `new` should probably report the identity of 99 - // the newly created commit. 100 98 insta::assert_snapshot!(stdout, @""); 101 - insta::assert_snapshot!(stderr, @""); 99 + insta::assert_snapshot!(stderr, @r###" 100 + Created new commit znkkpsqq 200ed1a1 (empty) (no description set) 101 + "###); 102 102 insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" 103 103 ◉ 200ed1a14c8acf09783dafefe5bebf2ff58f12fd 104 104 ├─╮