Skip to content

Commit

Permalink
squash: don't use unchanged source commit as predecessor
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvonz committed Apr 30, 2024
1 parent 1aeb5f3 commit 8df02a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cli/src/commands/squash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ 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())
Expand Down
15 changes: 6 additions & 9 deletions cli/tests/test_squash_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8df02a8

Please sign in to comment.