From 492dd99ba5763b027c0ff7a088fc4878727509fc Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sun, 28 Apr 2024 09:58:46 -0700 Subject: [PATCH] squash: add test that immutable commits are respected for `--from/--into` --- cli/tests/test_immutable_commits.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cli/tests/test_immutable_commits.rs b/cli/tests/test_immutable_commits.rs index 1a5ce85ad..5d4ac87ae 100644 --- a/cli/tests/test_immutable_commits.rs +++ b/cli/tests/test_immutable_commits.rs @@ -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###"