@@ -262,7 +262,7 @@ mod write_object {
262262 let oid = repo. write_object ( gix:: objs:: TreeRef :: empty ( ) ) ?;
263263 assert_eq ! (
264264 oid,
265- gix :: hash :: ObjectId :: empty_tree ( repo. object_hash( ) ) ,
265+ repo. object_hash( ) . empty_tree ( ) ,
266266 "it produces a well-known empty tree id"
267267 ) ;
268268 Ok ( ( ) )
@@ -277,7 +277,7 @@ mod write_object {
277277 time : Default :: default ( ) ,
278278 } ;
279279 let commit = gix:: objs:: Commit {
280- tree : gix :: hash :: ObjectId :: empty_tree ( repo. object_hash ( ) ) ,
280+ tree : repo. object_hash ( ) . empty_tree ( ) ,
281281 author : actor. clone ( ) ,
282282 committer : actor,
283283 parents : Default :: default ( ) ,
@@ -292,6 +292,21 @@ mod write_object {
292292 ) ;
293293 Ok ( ( ) )
294294 }
295+
296+ #[ test]
297+ fn blob_write_to_implementation ( ) -> crate :: Result {
298+ let repo = empty_bare_in_memory_repo ( ) ?;
299+ let blob = repo. empty_blob ( ) ;
300+
301+ // Create a blob directly to test our WriteTo implementation
302+ let actual_id = repo. write_object ( & blob) ?;
303+ let actual_blob = repo. find_object ( actual_id) ?. into_blob ( ) ;
304+ assert_eq ! ( actual_id, repo. object_hash( ) . empty_blob( ) ) ;
305+
306+ assert_eq ! ( actual_blob. data, blob. data) ;
307+
308+ Ok ( ( ) )
309+ }
295310}
296311
297312mod write_blob {
0 commit comments