@@ -12,6 +12,7 @@ use gix_diff::{
1212 Rewrites ,
1313} ;
1414use gix_object:: tree:: EntryKind ;
15+ use pretty_assertions:: assert_eq;
1516
1617use crate :: {
1718 hex_to_id,
@@ -51,6 +52,7 @@ fn rename_by_id() -> crate::Result {
5152 id: NULL_ID ,
5253 kind: SourceKind :: Rename ,
5354 location: "b" . into( ) ,
55+ change: & Change :: deletion( ) ,
5456 diff: None ,
5557 }
5658 ) ;
@@ -146,11 +148,16 @@ fn copy_by_id() -> crate::Result {
146148 let out = util:: assert_emit_with_objects (
147149 & mut track,
148150 |dst, src| {
151+ let id = hex_to_id ( "2e65efe2a145dda7ee51d1741299f848e5bf752e" ) ;
149152 let source_a = Source {
150153 entry_mode : EntryKind :: Blob . into ( ) ,
151- id : hex_to_id ( "2e65efe2a145dda7ee51d1741299f848e5bf752e" ) ,
154+ id : id ,
152155 kind : SourceKind :: Copy ,
153156 location : "a" . into ( ) ,
157+ change : & Change {
158+ id,
159+ ..Change :: modification ( )
160+ } ,
154161 diff : None ,
155162 } ;
156163 match calls {
@@ -219,6 +226,10 @@ fn copy_by_id_search_in_all_sources() -> crate::Result {
219226 id : content_id,
220227 kind : SourceKind :: Copy ,
221228 location : "a-src" . into ( ) ,
229+ change : & Change {
230+ id : content_id,
231+ ..Change :: modification ( )
232+ } ,
222233 diff : None ,
223234 } ;
224235 match calls {
@@ -289,11 +300,16 @@ fn copy_by_50_percent_similarity() -> crate::Result {
289300 let out = util:: assert_emit_with_objects (
290301 & mut track,
291302 |dst, src| {
303+ let id = hex_to_id ( "78981922613b2afb6025042ff6bd878ac1994e85" ) ;
292304 let source_a = Source {
293305 entry_mode : EntryKind :: Blob . into ( ) ,
294- id : hex_to_id ( "78981922613b2afb6025042ff6bd878ac1994e85" ) ,
306+ id : id ,
295307 kind : SourceKind :: Copy ,
296308 location : "a" . into ( ) ,
309+ change : & Change {
310+ id,
311+ ..Change :: modification ( )
312+ } ,
297313 diff : Some ( DiffLineStats {
298314 removals : 0 ,
299315 insertions : 1 ,
@@ -459,13 +475,18 @@ fn rename_by_50_percent_similarity() -> crate::Result {
459475 |dst, src| {
460476 match calls {
461477 0 => {
478+ let id = hex_to_id ( "66a52ee7a1d803dc57859c3e95ac9dcdc87c0164" ) ;
462479 assert_eq ! (
463480 src. unwrap( ) ,
464481 Source {
465482 entry_mode: EntryKind :: Blob . into( ) ,
466- id: hex_to_id ( "66a52ee7a1d803dc57859c3e95ac9dcdc87c0164" ) ,
483+ id: id ,
467484 kind: SourceKind :: Rename ,
468485 location: "a" . into( ) ,
486+ change: & Change {
487+ id,
488+ ..Change :: deletion( )
489+ } ,
469490 diff: Some ( DiffLineStats {
470491 removals: 1 ,
471492 insertions: 1 ,
@@ -532,7 +553,7 @@ fn add_only() -> crate::Result {
532553 let out = util:: assert_emit ( & mut track, |dst, src| {
533554 assert ! ( !called) ;
534555 called = true ;
535- assert_eq ! ( src, None , "there is just a single deletion, no pair" ) ;
556+ assert ! ( src. is_none ( ) , "there is just a single deletion, no pair" ) ;
536557 assert_eq ! ( dst. location, "a" ) ;
537558 assert_eq ! ( dst. change. kind, ChangeKind :: Addition ) ;
538559 Action :: Continue
@@ -569,22 +590,22 @@ mod util {
569590
570591 pub fn assert_emit (
571592 tracker : & mut rewrites:: Tracker < Change > ,
572- cb : impl FnMut ( Destination < ' _ , Change > , Option < Source < ' _ > > ) -> Action ,
593+ cb : impl FnMut ( Destination < ' _ , Change > , Option < Source < ' _ , Change > > ) -> Action ,
573594 ) -> rewrites:: Outcome {
574595 assert_emit_with_objects ( tracker, cb, gix_object:: find:: Never )
575596 }
576597
577598 pub fn assert_emit_with_objects (
578599 tracker : & mut rewrites:: Tracker < Change > ,
579- cb : impl FnMut ( Destination < ' _ , Change > , Option < Source < ' _ > > ) -> Action ,
600+ cb : impl FnMut ( Destination < ' _ , Change > , Option < Source < ' _ , Change > > ) -> Action ,
580601 objects : impl gix_object:: FindObjectOrHeader ,
581602 ) -> rewrites:: Outcome {
582603 assert_emit_with_objects_and_sources ( tracker, cb, objects, None )
583604 }
584605
585606 pub fn assert_emit_with_objects_and_sources < ' a > (
586607 tracker : & mut rewrites:: Tracker < Change > ,
587- cb : impl FnMut ( Destination < ' _ , Change > , Option < Source < ' _ > > ) -> Action ,
608+ cb : impl FnMut ( Destination < ' _ , Change > , Option < Source < ' _ , Change > > ) -> Action ,
588609 objects : impl gix_object:: FindObjectOrHeader ,
589610 sources : impl IntoIterator < Item = ( Change , & ' a str ) > ,
590611 ) -> rewrites:: Outcome {
0 commit comments