diff --git a/cli/src/commands/rebase.rs b/cli/src/commands/rebase.rs index 1d0a3817f..0a71e74e8 100644 --- a/cli/src/commands/rebase.rs +++ b/cli/src/commands/rebase.rs @@ -389,6 +389,7 @@ fn rebase_descendants_transaction( rebase_options: &RebaseOptions, ) -> Result<(), CommandError> { if target_roots.is_empty() { + writeln!(ui.status(), "Nothing changed.")?; return Ok(()); } @@ -496,6 +497,7 @@ fn rebase_revisions_transaction( rebase_options: &RebaseOptions, ) -> Result<(), CommandError> { if target_commits.is_empty() { + writeln!(ui.status(), "Nothing changed.")?; return Ok(()); } diff --git a/cli/tests/test_rebase_command.rs b/cli/tests/test_rebase_command.rs index f2dc4b1a2..4d5ce6df4 100644 --- a/cli/tests/test_rebase_command.rs +++ b/cli/tests/test_rebase_command.rs @@ -127,7 +127,7 @@ fn test_rebase_empty_sets() { // TODO: Make all of these say "Nothing changed"? let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-r=none()", "-d=b"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @""); + insta::assert_snapshot!(stderr, @"Nothing changed."); let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-s=none()", "-d=b"]); insta::assert_snapshot!(stderr, @r###"Error: Revset "none()" didn't resolve to any revisions"###); let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-b=none()", "-d=b"]); @@ -135,7 +135,7 @@ fn test_rebase_empty_sets() { // Empty because "b..a" is empty let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-b=a", "-d=b"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @""); + insta::assert_snapshot!(stderr, @"Nothing changed."); } #[test]