@@ -59,7 +59,10 @@ function parseFileChange(ctx: Context): AnyFileChange | undefined {
5959 if ( ! extHeader ) {
6060 break ;
6161 }
62- if ( extHeader . type === ExtendedHeader . Deleted ) isDeleted = true ;
62+ if ( extHeader . type === ExtendedHeader . Deleted ) {
63+ isDeleted = true ;
64+ pathBefore = comparisonLineParsed ?. from || '' ;
65+ }
6366 if ( extHeader . type === ExtendedHeader . NewFile ) {
6467 isNew = true ;
6568 pathAfter = comparisonLineParsed ?. to || '' ;
@@ -77,33 +80,30 @@ function parseFileChange(ctx: Context): AnyFileChange | undefined {
7780 const changeMarkers = parseChangeMarkers ( ctx ) ;
7881 const chunks = parseChunks ( ctx ) ;
7982
80- if ( isDeleted && changeMarkers ) {
83+ if ( isDeleted && chunks . length && chunks [ 0 ] . type === 'BinaryFilesChunk' ) {
8184 return {
8285 type : FileType . Deleted ,
8386 chunks,
84- path : changeMarkers . deleted ,
87+ path : chunks [ 0 ] . pathBefore ,
8588 } ;
86- } else if (
87- isDeleted &&
88- chunks . length &&
89- chunks [ 0 ] . type === 'BinaryFilesChunk'
90- ) {
89+ }
90+ if ( isDeleted ) {
9191 return {
9292 type : FileType . Deleted ,
9393 chunks,
94- path : chunks [ 0 ] . pathBefore ,
94+ path : changeMarkers ?. deleted || pathBefore ,
9595 } ;
96- } else if ( isNew ) {
96+ } else if ( isNew && chunks . length && chunks [ 0 ] . type === 'BinaryFilesChunk' ) {
9797 return {
9898 type : FileType . Added ,
9999 chunks,
100- path : changeMarkers ? changeMarkers . added : pathAfter ,
100+ path : chunks [ 0 ] . pathAfter ,
101101 } ;
102- } else if ( isNew && chunks . length && chunks [ 0 ] . type === 'BinaryFilesChunk' ) {
102+ } else if ( isNew ) {
103103 return {
104104 type : FileType . Added ,
105105 chunks,
106- path : chunks [ 0 ] . pathAfter ,
106+ path : changeMarkers ?. added || pathAfter ,
107107 } ;
108108 } else if ( isRename ) {
109109 return {
0 commit comments