diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index be61f4ad1f..1c37c99fbb 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -1658,9 +1658,6 @@ pub fn resolve_multiple_nonempty_revsets_default_single( let mut all_commits = IndexSet::new(); for revision_str in revisions { let commits = workspace_command.resolve_revset_default_single(revision_str)?; - if commits.is_empty() { - return Err(user_error("Empty revision set")); - } for commit in commits { let commit_hash = short_commit_hash(commit.id()); if !all_commits.insert(commit) { @@ -1670,7 +1667,11 @@ pub fn resolve_multiple_nonempty_revsets_default_single( } } } - Ok(all_commits) + if all_commits.is_empty() { + Err(user_error("Empty revision set")) + } else { + Ok(all_commits) + } } pub fn update_working_copy( diff --git a/cli/src/commands/new.rs b/cli/src/commands/new.rs index eec01cd4dd..1b10eca862 100644 --- a/cli/src/commands/new.rs +++ b/cli/src/commands/new.rs @@ -96,10 +96,6 @@ Please use `jj new 'all:x|y'` instead of `jj new --allow-large-revsets x y`.", )); } let mut workspace_command = command.workspace_helper(ui)?; - assert!( - !args.revisions.is_empty(), - "expected a non-empty list from clap" - ); let target_commits = resolve_multiple_nonempty_revsets_default_single(&workspace_command, &args.revisions)? .into_iter()