diff --git a/cli/src/commands/squash.rs b/cli/src/commands/squash.rs index 2128dc6c17..94656aae93 100644 --- a/cli/src/commands/squash.rs +++ b/cli/src/commands/squash.rs @@ -297,7 +297,11 @@ from the source will be moved into the destination. } }; let mut predecessors = vec![destination.id().clone()]; - predecessors.extend(sources.iter().map(|source| source.id().clone())); + predecessors.extend( + source_commits + .iter() + .map(|source| source.commit.id().clone()), + ); tx.mut_repo() .rewrite_commit(settings, &rewritten_destination) .set_tree_id(destination_tree.id().clone()) diff --git a/cli/tests/test_squash_command.rs b/cli/tests/test_squash_command.rs index ea4eb71d97..871939c6dd 100644 --- a/cli/tests/test_squash_command.rs +++ b/cli/tests/test_squash_command.rs @@ -910,16 +910,13 @@ fn test_squash_from_multiple_partial_no_op() { r#"separate(" ", commit_id.short(), description)"#, ], ); - // TODO: Commit c should not be a predecessor insta::assert_snapshot!(stdout, @r###" - @ 9227d0d780fa d - ├─┬─╮ - ◉ │ │ 09441f0a6266 d - ◉ │ │ cba0f0aa472b d - ◉ │ 285201979c90 b - ◉ │ 81187418277d b - ◉ 5ad3ca4090a7 c - ◉ 7cfbaf71a279 c + @ 9227d0d780fa d + ├─╮ + ◉ │ 09441f0a6266 d + ◉ │ cba0f0aa472b d + ◉ 285201979c90 b + ◉ 81187418277d b "###); // If no source commits match the paths, then the whole operation is a no-op