diff --git a/cli/src/commands/git.rs b/cli/src/commands/git.rs index 827779707..f877fc384 100644 --- a/cli/src/commands/git.rs +++ b/cli/src/commands/git.rs @@ -791,7 +791,10 @@ fn cmd_git_push( } } if !args.revisions.is_empty() && branches_targeted.is_empty() { - return Err(user_error("No branches point to the specified revisions.")); + writeln!( + ui.warning(), + "No branches point to the specified revisions." + )?; } tx_description = format!( diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index fbbe58b04..b5ef3ddb6 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -341,9 +341,12 @@ fn test_git_push_revisions() { Error: Empty revision set "###); // Push a revision with no branches - let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "-r=@--"]); + let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-r=@--"]); + insta::assert_snapshot!(stdout, @r###" + Nothing changed. + "###); insta::assert_snapshot!(stderr, @r###" - Error: No branches point to the specified revisions. + No branches point to the specified revisions. "###); // Push a revision with a single branch let stdout = test_env.jj_cmd_success(&workspace_root, &["git", "push", "-r=@-", "--dry-run"]);