@@ -348,7 +348,7 @@ fn process_change(
348348 ) ) ;
349349
350350 let new_hunk = if hunk. range_in_destination . end > unchanged. end {
351- Some ( UnblamedHunk :: new (
351+ Some ( UnblamedHunk :: from_destination (
352352 unchanged. end ..hunk. range_in_destination . end ,
353353 hunk. offset ( ) ,
354354 ) )
@@ -1315,6 +1315,44 @@ fn process_change_works_unchanged_hunk_2() {
13151315 assert_eq ! ( offset_in_destination, Offset :: Added ( 0 ) ) ;
13161316}
13171317
1318+ #[ test]
1319+ fn process_change_works_unchanged_hunk_3 ( ) {
1320+ let mut lines_blamed: Vec < BlameEntry > = vec ! [ ] ;
1321+ let mut new_hunks_to_blame: Vec < UnblamedHunk > = vec ! [ ] ;
1322+ let mut offset_in_destination: Offset = Offset :: Deleted ( 2 ) ;
1323+ let suspect = ObjectId :: null ( gix_hash:: Kind :: Sha1 ) ;
1324+
1325+ let ( hunk, change) = process_change (
1326+ & mut lines_blamed,
1327+ & mut new_hunks_to_blame,
1328+ & mut offset_in_destination,
1329+ suspect,
1330+ Some ( UnblamedHunk {
1331+ range_in_blamed_file : 22 ..30 ,
1332+ range_in_destination : 21 ..29 ,
1333+ } ) ,
1334+ Some ( Change :: Unchanged ( 21 ..23 ) ) ,
1335+ ) ;
1336+
1337+ assert_eq ! (
1338+ hunk,
1339+ Some ( UnblamedHunk {
1340+ range_in_blamed_file: 24 ..30 ,
1341+ range_in_destination: 23 ..29
1342+ } )
1343+ ) ;
1344+ assert_eq ! ( change, None ) ;
1345+ assert_eq ! ( lines_blamed, vec![ ] ) ;
1346+ assert_eq ! (
1347+ new_hunks_to_blame,
1348+ vec![ UnblamedHunk {
1349+ range_in_blamed_file: 22 ..24 ,
1350+ range_in_destination: 23 ..25
1351+ } ]
1352+ ) ;
1353+ assert_eq ! ( offset_in_destination, Offset :: Deleted ( 2 ) ) ;
1354+ }
1355+
13181356#[ test]
13191357fn process_change_works_deleted_hunk ( ) {
13201358 let mut lines_blamed: Vec < BlameEntry > = vec ! [ ] ;
0 commit comments