diff --git a/cli/src/commands/git.rs b/cli/src/commands/git.rs index 2626a9452..d5d2b7a0c 100644 --- a/cli/src/commands/git.rs +++ b/cli/src/commands/git.rs @@ -41,9 +41,8 @@ use jj_lib::workspace::Workspace; use maplit::hashset; use crate::cli_util::{ - parse_string_pattern, print_trackable_remote_branches, resolve_multiple_nonempty_revsets, - short_change_hash, short_commit_hash, start_repo_transaction, CommandHelper, RevisionArg, - WorkspaceCommandHelper, + parse_string_pattern, print_trackable_remote_branches, short_change_hash, short_commit_hash, + start_repo_transaction, CommandHelper, RevisionArg, WorkspaceCommandHelper, }; use crate::command_error::{ user_error, user_error_with_hint, user_error_with_hint_opt, user_error_with_message, @@ -1190,11 +1189,9 @@ fn find_branches_targeted_by_revisions<'a>( current_branches_revset.iter().collect() } else { // TODO: Narrow search space to local target commits. - // TODO: Remove redundant CommitId -> Commit -> CommitId round trip. - resolve_multiple_nonempty_revsets(revisions, workspace_command)? - .iter() - .map(|commit| commit.id().clone()) - .collect() + let expression = workspace_command.parse_union_revsets(revisions)?; + let revset = workspace_command.evaluate_revset(expression)?; + revset.iter().collect() }; let branches_targeted = workspace_command .repo() diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index b4e00fd94..678cbf545 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -454,9 +454,10 @@ fn test_git_push_revisions() { std::fs::write(workspace_root.join("file"), "modified again").unwrap(); // Push an empty set - let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "-r=none()"]); + let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-r=none()"]); insta::assert_snapshot!(stderr, @r###" - Error: Empty revision set + No branches point to the specified revisions. + Nothing changed. "###); // Push a revision with no branches let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-r=@--"]);