diff --git a/cli/src/commands/new.rs b/cli/src/commands/new.rs index de7d670f9..eec01cd4d 100644 --- a/cli/src/commands/new.rs +++ b/cli/src/commands/new.rs @@ -129,17 +129,11 @@ Please use `jj new 'all:x|y'` instead of `jj new --allow-large-revsets x y`.", short_commit_hash(&commit_id), ))); } - let mut new_parents_commits: Vec = new_parents + let new_parents_commits: Vec = new_parents .evaluate_programmatic(tx.repo())? .iter() .commits(tx.repo().store()) .try_collect()?; - // The git backend does not support creating merge commits involving the root - // commit. - if new_parents_commits.len() > 1 { - let root_commit = tx.repo().store().root_commit(); - new_parents_commits.retain(|c| c != &root_commit); - } let merged_tree = merge_commit_trees(tx.repo(), &new_parents_commits)?; let new_parents_commit_id = new_parents_commits.iter().map(|c| c.id().clone()).collect(); new_commit = tx diff --git a/cli/tests/test_new_command.rs b/cli/tests/test_new_command.rs index 55462dc56..18de96123 100644 --- a/cli/tests/test_new_command.rs +++ b/cli/tests/test_new_command.rs @@ -417,26 +417,10 @@ fn test_new_insert_before_no_root_merge() { ◉ root "###); - let (stdout, stderr) = - test_env.jj_cmd_ok(&repo_path, &["new", "--insert-before", "-m", "G", "B", "D"]); - insta::assert_snapshot!(stdout, @""); + let stderr = + test_env.jj_cmd_failure(&repo_path, &["new", "--insert-before", "-m", "G", "B", "D"]); insta::assert_snapshot!(stderr, @r###" - Rebased 4 descendant commits - Working copy now at: kxryzmor bf9fc493 (empty) G - Parent commit : qpvuntsm 65b1ef43 A | (empty) A - "###); - insta::assert_snapshot!(get_short_log_output(&test_env, &repo_path), @r###" - ◉ F - ├─╮ - │ ◉ E - ◉ │ D - │ │ ◉ C - │ │ ◉ B - ├───╯ - @ │ G - ◉ │ A - ├─╯ - ◉ root + Error: The Git backend does not support creating merge commits with the root commit as one of the parents. "###); }