Skip to content

Commit

Permalink
Add another test to assure the editor works as expected.
Browse files Browse the repository at this point in the history
It's paramount that it works so that custom tree's added
will be rewritten if blobs are 'inserted' into them.
  • Loading branch information
Byron committed Oct 17, 2024
1 parent 75ed15e commit 7af99ad
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gix-object/tests/object/tree/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,24 @@ fn from_empty_add() -> crate::Result {
"still, only the root-tree changes effectively"
);
assert_eq!(odb.access_count_and_clear(), 0);

let actual = edit
.upsert(["a", "b"], EntryKind::Tree, empty_tree())?
.upsert(["a", "b", "c"], EntryKind::BlobExecutable, any_blob())?
// .upsert(["a", "b", "d"], EntryKind::Blob, any_blob())?
.write(&mut write)?;
assert_eq!(
display_tree(actual, &storage),
"d8d3f558776965f70452625b72363234f517b290
└── a
└── b
└── c bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.100755
",
"the intermediate tree is rewritten to be suitable to hold the blob"
);
assert_eq!(num_writes_and_clear(), 3, "root, and two child-trees");
assert_eq!(odb.access_count_and_clear(), 0);

Ok(())
}

Expand Down

0 comments on commit 7af99ad

Please sign in to comment.