ok/jj
1
0
Fork 0
forked from mirrors/jj

squash: don't use unchanged source commit as predecessor

This commit is contained in:
Martin von Zweigbergk 2024-04-29 08:56:51 -07:00 committed by Martin von Zweigbergk
parent 09b960538a
commit 7093d5d359
2 changed files with 11 additions and 10 deletions

View file

@ -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())

View file

@ -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