mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-13 15:37:55 +00:00
cli: make "duplicate none()" exit successfully
Per discussion in https://github.com/martinvonz/jj/pull/3311#discussion_r1527171058 We can also rely on the default "Nothing changed." handling, but it seems better to state the input set is empty.
This commit is contained in:
parent
f46b738f6e
commit
f678ba08cf
2 changed files with 4 additions and 3 deletions
|
@ -48,7 +48,8 @@ pub(crate) fn cmd_duplicate(
|
|||
revset.iter().collect() // in reverse topological order
|
||||
};
|
||||
if to_duplicate.is_empty() {
|
||||
return Err(user_error("No revisions to duplicate"));
|
||||
writeln!(ui.stderr(), "No revisions to duplicate.")?;
|
||||
return Ok(());
|
||||
}
|
||||
if to_duplicate.last() == Some(workspace_command.repo().store().root_commit_id()) {
|
||||
return Err(user_error("Cannot duplicate the root commit"));
|
||||
|
|
|
@ -52,9 +52,9 @@ fn test_duplicate() {
|
|||
Error: Cannot duplicate the root commit
|
||||
"###);
|
||||
|
||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["duplicate", "none()"]);
|
||||
let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "none()"]);
|
||||
insta::assert_snapshot!(stderr, @r###"
|
||||
Error: No revisions to duplicate
|
||||
No revisions to duplicate.
|
||||
"###);
|
||||
|
||||
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a"]);
|
||||
|
|
Loading…
Reference in a new issue