File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -113,4 +113,16 @@ impl Kind {
113113 Kind :: Sha1 => ObjectId :: null_sha1 ( ) ,
114114 }
115115 }
116+
117+ /// Create an owned empty-blob id of our hash kind.
118+ #[ inline]
119+ pub const fn empty_blob ( & self ) -> ObjectId {
120+ ObjectId :: empty_blob ( * self )
121+ }
122+
123+ /// Create an owned empty-tree id of our hash kind.
124+ #[ inline]
125+ pub const fn empty_tree ( & self ) -> ObjectId {
126+ ObjectId :: empty_tree ( * self )
127+ }
116128}
Original file line number Diff line number Diff line change @@ -14,3 +14,19 @@ mod from_hex_len {
1414 assert_eq ! ( Kind :: from_hex_len( 65 ) , None ) ;
1515 }
1616}
17+
18+ mod empty_objects {
19+ use gix_hash:: { Kind , ObjectId } ;
20+
21+ #[ test]
22+ fn empty_blob ( ) {
23+ let kind = Kind :: Sha1 ;
24+ assert_eq ! ( kind. empty_blob( ) , ObjectId :: empty_blob( kind) ) ;
25+ }
26+
27+ #[ test]
28+ fn empty_tree ( ) {
29+ let kind = Kind :: Sha1 ;
30+ assert_eq ! ( kind. empty_tree( ) , ObjectId :: empty_tree( kind) ) ;
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments