mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-01 00:50:57 +00:00
cli: make jj move nonexistent
succeed
I think `jj move nonexistent` should not be an error. That matches how `jj squash` works. I added tests for both commands.
This commit is contained in:
parent
9230fd93bb
commit
b6b3703800
3 changed files with 18 additions and 1 deletions
|
@ -2220,7 +2220,7 @@ from the source will be moved into the destination.
|
|||
args.interactive,
|
||||
matcher.as_ref(),
|
||||
)?;
|
||||
if &new_parent_tree_id == parent_tree.id() {
|
||||
if args.interactive && &new_parent_tree_id == parent_tree.id() {
|
||||
return Err(user_error("No changes to move"));
|
||||
}
|
||||
let new_parent_tree = tx
|
||||
|
|
|
@ -317,6 +317,14 @@ fn test_move_partial() {
|
|||
insta::assert_snapshot!(stdout, @r###"
|
||||
a
|
||||
"###);
|
||||
|
||||
// If we specify only a non-existent file, then the move still succeeds and
|
||||
// creates unchanged commits.
|
||||
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["move", "--from", "c", "nonexistent"]);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
Working copy now at: b670567d9438 (no description set)
|
||||
"###);
|
||||
}
|
||||
|
||||
fn get_log_output(test_env: &TestEnvironment, cwd: &Path) -> String {
|
||||
|
|
|
@ -230,6 +230,15 @@ fn test_squash_partial() {
|
|||
insta::assert_snapshot!(stdout, @r###"
|
||||
b
|
||||
"###);
|
||||
|
||||
// If we specify only a non-existent file, then the squash still succeeds and
|
||||
// creates unchanged commits.
|
||||
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
||||
let stdout = test_env.jj_cmd_success(&repo_path, &["squash", "-r", "b", "nonexistent"]);
|
||||
insta::assert_snapshot!(stdout, @r###"
|
||||
Rebased 1 descendant commits
|
||||
Working copy now at: 5e297967f76c (no description set)
|
||||
"###);
|
||||
}
|
||||
|
||||
fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String {
|
||||
|
|
Loading…
Reference in a new issue