forked from mirrors/jj
git-push: do not error out on empty revision set
"-r REVISIONS" here specifies the search space of the branches to push, and warned if no branches are found in that space. I don't think an empty set should be an error, but a warning for consistency. The warning message will be improved by the subsequent patches.
This commit is contained in:
parent
02c0927734
commit
bc7a42a00e
2 changed files with 8 additions and 10 deletions
|
@ -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()
|
||||
|
|
|
@ -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=@--"]);
|
||||
|
|
Loading…
Reference in a new issue