File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,20 @@ function getDiffRanges(
375
375
logger : Logger ,
376
376
) : DiffThunkRange [ ] | undefined {
377
377
if ( fileDiff . patch === undefined ) {
378
+ if ( fileDiff . changes === 0 ) {
379
+ // There are situations where a changed file legitimately has no diff.
380
+ // For example, the file may be a binary file, or that the file may have
381
+ // been renamed with no changes to its contents. In these cases, the
382
+ // file would be reported as having 0 changes, and we can return an empty
383
+ // array to indicate no diff range in this file.
384
+ return [ ] ;
385
+ }
386
+ // If a file is reported to have nonzero changes but no patch, that may be
387
+ // due to the file diff being too large. In this case, we should return
388
+ // undefined to indicate that we cannot process the diff.
389
+ logger . warning (
390
+ `No patch found for file ${ fileDiff . filename } with ${ fileDiff . changes } changes.` ,
391
+ ) ;
378
392
return undefined ;
379
393
}
380
394
You can’t perform that action at this time.
0 commit comments