@@ -81,31 +81,59 @@ fn changes_against_tree_modified() -> crate::Result {
8181 assert_eq ! ( i, 3 ) ;
8282
8383 let actual = repo. diff_tree_to_tree ( & from, & to, None ) ?;
84- insta:: assert_debug_snapshot!( actual, @r#"
85- [
86- Modification {
87- location: "a",
88- previous_entry_mode: EntryMode(0o100644),
89- previous_id: Sha1(78981922613b2afb6025042ff6bd878ac1994e85),
90- entry_mode: EntryMode(0o100644),
91- id: Sha1(b4f17b61de71d9b2e54ac9e62b1629ae2d97a6a7),
92- },
93- Modification {
94- location: "dir",
95- previous_entry_mode: EntryMode(0o40000),
96- previous_id: Sha1(e5c63aefe4327cb1c780c71966b678ce8e4225da),
97- entry_mode: EntryMode(0o40000),
98- id: Sha1(c7ac5f82f536976f3561c9999b5f11e5893358be),
99- },
100- Modification {
101- location: "dir/c",
102- previous_entry_mode: EntryMode(0o100644),
103- previous_id: Sha1(6695780ceb14b05e076a99bbd2babf34723b3464),
104- entry_mode: EntryMode(0o100644),
105- id: Sha1(40006fcef15a8853a1b7ae186d93b7d680fd29cf),
106- },
107- ]
108- "# ) ;
84+ match repo. object_hash ( ) {
85+ gix:: hash:: Kind :: Sha1 => insta:: assert_debug_snapshot!( actual, @r#"
86+ [
87+ Modification {
88+ location: "a",
89+ previous_entry_mode: EntryMode(0o100644),
90+ previous_id: Sha1(78981922613b2afb6025042ff6bd878ac1994e85),
91+ entry_mode: EntryMode(0o100644),
92+ id: Sha1(b4f17b61de71d9b2e54ac9e62b1629ae2d97a6a7),
93+ },
94+ Modification {
95+ location: "dir",
96+ previous_entry_mode: EntryMode(0o40000),
97+ previous_id: Sha1(e5c63aefe4327cb1c780c71966b678ce8e4225da),
98+ entry_mode: EntryMode(0o40000),
99+ id: Sha1(c7ac5f82f536976f3561c9999b5f11e5893358be),
100+ },
101+ Modification {
102+ location: "dir/c",
103+ previous_entry_mode: EntryMode(0o100644),
104+ previous_id: Sha1(6695780ceb14b05e076a99bbd2babf34723b3464),
105+ entry_mode: EntryMode(0o100644),
106+ id: Sha1(40006fcef15a8853a1b7ae186d93b7d680fd29cf),
107+ },
108+ ]
109+ "# ) ,
110+ gix:: hash:: Kind :: Sha256 => insta:: assert_debug_snapshot!( actual, @r#"
111+ [
112+ Modification {
113+ location: "a",
114+ previous_entry_mode: EntryMode(0o100644),
115+ previous_id: Sha256(f8625e43f9e04f24291f77cdbe4c71b3c2a3b0003f60419b3ed06a058d766c8b),
116+ entry_mode: EntryMode(0o100644),
117+ id: Sha256(6eba3a291223ebd59db7f157409b70bb1f929be92ed8df0fba98cb81852ff378),
118+ },
119+ Modification {
120+ location: "dir",
121+ previous_entry_mode: EntryMode(0o40000),
122+ previous_id: Sha256(0d8c11bd683002c6f7c29c94e952cc3ebe2e0e10bd781846285998a509ebd746),
123+ entry_mode: EntryMode(0o40000),
124+ id: Sha256(730477dc62b02d7046105a95e8c37dc204943f24c70da12d33a88012ac7d2613),
125+ },
126+ Modification {
127+ location: "dir/c",
128+ previous_entry_mode: EntryMode(0o100644),
129+ previous_id: Sha256(b7bb7be9f73f0d01719f57dcb697689692e2ae9737f4bb59216902b9a0e2adb1),
130+ entry_mode: EntryMode(0o100644),
131+ id: Sha256(8cf8e3576bb1c632c9f2e1196d2aa6b1ae36c6f651d7619dca4894b784065819),
132+ },
133+ ]
134+ "# ) ,
135+ _ => unreachable ! ( ) ,
136+ }
109137
110138 assert_eq ! (
111139 from. changes( ) ?. stats( & to) ?,
@@ -140,6 +168,11 @@ mod track_rewrites {
140168 ignore = "Fails on some Window systems, like the fixture doesn't get set up correctly."
141169 ) ]
142170 fn jj_realistic_needs_to_be_more_clever ( ) -> crate :: Result {
171+ // The test case only works (and is only needed) for SHA-1.
172+ // Ideally this can be ported to SHA-256 once rename tracking is par with Git.
173+ if gix_testtools:: object_hash ( ) == gix:: hash:: Kind :: Sha256 {
174+ return Ok ( ( ) ) ;
175+ }
143176 let repo = named_subrepo_opts ( "make_diff_repos.sh" , "jj-trackcopy-1" , gix:: open:: Options :: isolated ( ) ) ?;
144177
145178 let mut expected = HashMap :: < & BStr , ( & BStr , u32 ) > :: new ( ) ;
@@ -419,6 +452,11 @@ mod track_rewrites {
419452 ignore = "Fails on some Window systems, like the fixture doesn't get set up correctly."
420453 ) ]
421454 fn jj_realistic_directory_rename ( ) -> crate :: Result {
455+ // The test case only works (and is only needed) for SHA-1.
456+ // Ideally this can be ported to SHA-256 once rename tracking is par with Git.
457+ if gix_testtools:: object_hash ( ) == gix:: hash:: Kind :: Sha256 {
458+ return Ok ( ( ) ) ;
459+ }
422460 let repo = named_subrepo_opts ( "make_diff_repos.sh" , "jj-trackcopy-1" , gix:: open:: Options :: isolated ( ) ) ?;
423461
424462 let from = tree_named ( & repo, "@~1" ) ;
0 commit comments