Skip to content

Commit a1dfc74

Browse files
committed
Add another test to assure the editor works as expected.
It's paramount that it works so that custom tree's added will be rewritten if blobs are 'inserted' into them.
1 parent 0f46d24 commit a1dfc74

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

gix-object/tests/object/tree/editor.rs

+18
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,24 @@ fn from_empty_add() -> crate::Result {
532532
"still, only the root-tree changes effectively"
533533
);
534534
assert_eq!(odb.access_count_and_clear(), 0);
535+
536+
let actual = edit
537+
.upsert(["a", "b"], EntryKind::Tree, empty_tree())?
538+
.upsert(["a", "b", "c"], EntryKind::BlobExecutable, any_blob())?
539+
// .upsert(["a", "b", "d"], EntryKind::Blob, any_blob())?
540+
.write(&mut write)?;
541+
assert_eq!(
542+
display_tree(actual, &storage),
543+
"d8d3f558776965f70452625b72363234f517b290
544+
└── a
545+
└── b
546+
└── c bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.100755
547+
",
548+
"the intermediate tree is rewritten to be suitable to hold the blob"
549+
);
550+
assert_eq!(num_writes_and_clear(), 3, "root, and two child-trees");
551+
assert_eq!(odb.access_count_and_clear(), 0);
552+
535553
Ok(())
536554
}
537555

0 commit comments

Comments
 (0)