mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-28 15:26:25 +00:00
rebase: add test showing unexpected commit abandoning
This commit is contained in:
parent
b0eb7764d4
commit
5b8e755909
1 changed files with 50 additions and 0 deletions
|
@ -2488,6 +2488,56 @@ fn test_rebase_skip_emptied() {
|
|||
"###);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rebase_skip_emptied_descendants() {
|
||||
let test_env = TestEnvironment::default();
|
||||
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
|
||||
let repo_path = test_env.env_root().join("repo");
|
||||
|
||||
create_commit(&test_env, &repo_path, "a", &[]);
|
||||
create_commit(&test_env, &repo_path, "b", &["a"]);
|
||||
test_env.jj_cmd_ok(&repo_path, &["new", "a", "-m", "c (will become empty)"]);
|
||||
test_env.jj_cmd_ok(&repo_path, &["restore", "--from=b"]);
|
||||
test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "c"]);
|
||||
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "already empty"]);
|
||||
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "also already empty"]);
|
||||
|
||||
// Test the setup
|
||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]), @r#"
|
||||
@ also already empty
|
||||
○ already empty
|
||||
○ c (will become empty)
|
||||
│ ○ b
|
||||
├─╯
|
||||
○ a
|
||||
◆
|
||||
"#);
|
||||
|
||||
// TODO: Use `-r` instead of `-s` once `-r --skip-emptied` is supported.
|
||||
let (stdout, stderr) = test_env.jj_cmd_ok(
|
||||
&repo_path,
|
||||
&["rebase", "-s", "b", "--before", "c", "--skip-emptied"],
|
||||
);
|
||||
insta::assert_snapshot!(stdout, @"");
|
||||
insta::assert_snapshot!(stderr, @r#"
|
||||
Skipped rebase of 1 commits that were already in place
|
||||
Rebased 2 descendant commits
|
||||
Abandoned 1 newly emptied commits
|
||||
Working copy now at: znkkpsqq 873ada86 (empty) also already empty
|
||||
Parent commit : yostqsxw bfc5dad7 (empty) already empty
|
||||
"#);
|
||||
|
||||
// TODO: Commits not in the rebase target set should not be abandoned even
|
||||
// if they were emptied.
|
||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]), @r#"
|
||||
@ also already empty
|
||||
○ already empty
|
||||
○ b
|
||||
○ a
|
||||
◆
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rebase_skip_if_on_destination() {
|
||||
let test_env = TestEnvironment::default();
|
||||
|
|
Loading…
Reference in a new issue