forked from mirrors/jj
Test that jj abandon root
, specifying same revision twice
This commit is contained in:
parent
f2114f63ee
commit
7057ce2183
1 changed files with 45 additions and 0 deletions
|
@ -108,6 +108,51 @@ fn test_rebase_branch_with_merge() {
|
||||||
o a e??
|
o a e??
|
||||||
o c d e??
|
o c d e??
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
|
// Test abandoning the same commit twice directly
|
||||||
|
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
||||||
|
let stdout = test_env.jj_cmd_success(&repo_path, &["abandon", "b", "b"]);
|
||||||
|
// Note that the same commit is listed twice
|
||||||
|
insta::assert_snapshot!(stdout, @r###"
|
||||||
|
Abandoned the following commits:
|
||||||
|
1394f625cbbd b
|
||||||
|
1394f625cbbd b
|
||||||
|
"###);
|
||||||
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||||
|
@ e
|
||||||
|
|\
|
||||||
|
o | d
|
||||||
|
o | c
|
||||||
|
| o a b
|
||||||
|
|/
|
||||||
|
o
|
||||||
|
"###);
|
||||||
|
|
||||||
|
// Test abandoning the same commit twice indirectly
|
||||||
|
test_env.jj_cmd_success(&repo_path, &["undo"]);
|
||||||
|
let stdout = test_env.jj_cmd_success(&repo_path, &["abandon", "d:", "a:"]);
|
||||||
|
// Note that the same commit is listed twice
|
||||||
|
insta::assert_snapshot!(stdout, @r###"
|
||||||
|
Abandoned the following commits:
|
||||||
|
5557ece3e631 e
|
||||||
|
b7c62f28ed10 d
|
||||||
|
5557ece3e631 e
|
||||||
|
1394f625cbbd b
|
||||||
|
2443ea76b0b1 a
|
||||||
|
Working copy now at: af874bffee6e (no description set)
|
||||||
|
Added 0 files, modified 0 files, removed 4 files
|
||||||
|
"###);
|
||||||
|
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
|
||||||
|
@
|
||||||
|
| o c d e??
|
||||||
|
|/
|
||||||
|
o a b e??
|
||||||
|
"###);
|
||||||
|
|
||||||
|
let stderr = test_env.jj_cmd_failure(&repo_path, &["abandon", "root"]);
|
||||||
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
Error: Cannot rewrite the root commit
|
||||||
|
"###);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String {
|
fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String {
|
||||||
|
|
Loading…
Reference in a new issue