squash: add test that immutable commits are respected for --from/--into

This commit is contained in:
Martin von Zweigbergk 2024-04-28 09:58:46 -07:00 committed by Martin von Zweigbergk
parent 9503179ea4
commit 492dd99ba5

View file

@ -247,12 +247,24 @@ fn test_rewrite_immutable_commands() {
Error: Commit 406c181c04d8 is immutable
Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// squash
// squash -r
let stderr = test_env.jj_cmd_failure(&repo_path, &["squash", "-r=description(b)"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit c8d4c7ca95d0 is immutable
Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// squash --from
let stderr = test_env.jj_cmd_failure(&repo_path, &["squash", "--from=main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit 406c181c04d8 is immutable
Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// squash --into
let stderr = test_env.jj_cmd_failure(&repo_path, &["squash", "--into=main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit 406c181c04d8 is immutable
Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// unsquash
let stderr = test_env.jj_cmd_failure(&repo_path, &["unsquash", "-r=main"]);
insta::assert_snapshot!(stderr, @r###"