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

conflicts: consider the empty tree a non-legacy tree

Since we no longer depend on legacy trees being preserved when we
build new trees or merge trees, we can consider the root tree a
non-legacy tree.
This commit is contained in:
Martin von Zweigbergk 2024-05-26 11:17:12 -07:00 committed by Martin von Zweigbergk
parent 43bf8667d8
commit 7e6a968415
3 changed files with 5 additions and 14 deletions

View file

@ -383,7 +383,7 @@ fn test_op_abandon_ancestors() {
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "workingcopy", "--ignore-working-copy"]), @r###"
Current operation: OperationId("10e856d0579c4aca88972ffea0a515f47f8c09dceaa2b1a5d531c83b04350f7aa64a3eff422def01eebd65df26089ef5e0f925f247a8f929c8cc858d16306e53")
Current tree: Legacy(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904"))
Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
"###);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["op", "log"]), @r###"
@ 10e856d0579c test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00
@ -432,7 +432,7 @@ fn test_op_abandon_ancestors() {
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "workingcopy", "--ignore-working-copy"]), @r###"
Current operation: OperationId("445e93662d714f53fb97e450eb3793a8e1a9a4cca1e329d5a9096e65085fb96d5bb51659531145c8abf0db5da803cd11c4cecdcf9025391bc97fc6a42204a0fe")
Current tree: Legacy(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904"))
Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
"###);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["op", "log"]), @r###"
@ 445e93662d71 test-username@host.example.com 2001-02-03 04:05:21.000 +07:00 - 2001-02-03 04:05:21.000 +07:00
@ -477,7 +477,7 @@ fn test_op_abandon_without_updating_working_copy() {
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "workingcopy", "--ignore-working-copy"]), @r###"
Current operation: OperationId("61aeade2493b190412c61b9b0711025c2cccf95966870a5f7dc2e34ab313fbef64da70d00cab2cd69ad39816faeb80a6bc866927549b84dce6cb5a437e0e515b")
Current tree: Legacy(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904"))
Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
"###);
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["op", "log", "-l1", "--ignore-working-copy"]), @r###"
@ -497,7 +497,7 @@ fn test_op_abandon_without_updating_working_copy() {
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "workingcopy", "--ignore-working-copy"]), @r###"
Current operation: OperationId("61aeade2493b190412c61b9b0711025c2cccf95966870a5f7dc2e34ab313fbef64da70d00cab2cd69ad39816faeb80a6bc866927549b84dce6cb5a437e0e515b")
Current tree: Legacy(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904"))
Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
"###);
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["op", "log", "-l1", "--ignore-working-copy"]), @r###"

View file

@ -107,7 +107,7 @@ impl Store {
}
pub fn empty_merged_tree_id(&self) -> MergedTreeId {
MergedTreeId::Legacy(self.backend.empty_tree_id().clone())
MergedTreeId::resolved(self.backend.empty_tree_id().clone())
}
pub fn root_commit(self: &Arc<Self>) -> Commit {

View file

@ -211,15 +211,6 @@ fn test_from_legacy_tree() {
MergedTreeVal::Resolved(tree.value(dir1_basename))
);
// Also test that MergedTreeBuilder can create the same tree by starting from an
// empty legacy tree.
let mut tree_builder = MergedTreeBuilder::new(store.empty_merged_tree_id());
for (path, value) in tree.entries() {
tree_builder.set_or_remove(path, Merge::normal(value));
}
let recreated_legacy_id = tree_builder.write_tree(store).unwrap();
assert_eq!(recreated_legacy_id, MergedTreeId::Legacy(tree_id.clone()));
// Create the merged tree by starting from an empty merged tree and adding
// entries from the merged tree we created before
let empty_merged_id_builder: MergeBuilder<_> = std::iter::repeat(store.empty_tree_id())