@@ -38,10 +38,10 @@ impl Headers {
3838 ///
3939 /// Useful for when [`Self::change_id`] is `None`.
4040 ///
41- /// These synthesized IDs are compatible with Jujutsu's deterministic scheme, including for
42- /// SHA-256 object IDs .
41+ /// These synthesized IDs are compatible with Jujutsu's deterministic scheme,
42+ /// and JJ would create exactly the same change-id if given the `commit_id` .
4343 pub fn synthetic_change_id_from_commit_id ( commit_id : gix:: ObjectId ) -> ChangeId {
44- let bytes: Vec < _ > = commit_id. as_bytes ( ) [ 4 ..commit_id . kind ( ) . len_in_bytes ( ) ]
44+ let bytes: Vec < _ > = commit_id. as_bytes ( ) [ 4 ..gix :: hash :: Kind :: Sha1 . len_in_bytes ( ) ]
4545 . iter ( )
4646 . rev ( )
4747 . map ( |byte| byte. reverse_bits ( ) )
@@ -59,10 +59,7 @@ impl Headers {
5959 if self . change_id . is_none ( ) {
6060 self . change_id = commit_id
6161 . into ( )
62- . map_or_else (
63- ChangeId :: generate_sha1,
64- Self :: synthetic_change_id_from_commit_id,
65- )
62+ . map_or_else ( ChangeId :: generate, Self :: synthetic_change_id_from_commit_id)
6663 . into ( ) ;
6764 }
6865 self
@@ -73,7 +70,7 @@ impl Headers {
7370 #[ deprecated = "We want deterministic change-ids, use Headers::synthetic_change_id_from_commit_id() instead." ]
7471 pub fn new_with_random_change_id ( ) -> Self {
7572 Self {
76- change_id : Some ( ChangeId :: generate_sha1 ( ) ) ,
73+ change_id : Some ( ChangeId :: generate ( ) ) ,
7774 conflicted : None ,
7875 }
7976 }
@@ -94,7 +91,7 @@ impl Headers {
9491 . ok ( )
9592 . map ( ChangeId :: from_number_for_testing)
9693 } )
97- . unwrap_or_else ( ChangeId :: generate_sha1 ) ,
94+ . unwrap_or_else ( ChangeId :: generate ) ,
9895 ) ,
9996 conflicted : None ,
10097 }
0 commit comments