File tree 2 files changed +4
-0
lines changed
2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -21657,6 +21657,8 @@ class Git {
21657
21657
return `\n${ string }`.split('\ndiff --git').slice(1).reduce((resultDict, fileDiff) => {
21658
21658
const lines = fileDiff.split('\n')
21659
21659
const lastHeaderLineIndex = lines.findIndex((line) => line.startsWith('+++'))
21660
+ if (lastHeaderLineIndex === -1) return resultDict // ignore binary files
21661
+
21660
21662
const plainDiff = lines.slice(lastHeaderLineIndex + 1).join('\n').trim()
21661
21663
let filePath = ''
21662
21664
if (lines[lastHeaderLineIndex].startsWith('+++ b/')) { // every file except removed files
Original file line number Diff line number Diff line change @@ -160,6 +160,8 @@ class Git {
160
160
return `\n${ string } ` . split ( '\ndiff --git' ) . slice ( 1 ) . reduce ( ( resultDict , fileDiff ) => {
161
161
const lines = fileDiff . split ( '\n' )
162
162
const lastHeaderLineIndex = lines . findIndex ( ( line ) => line . startsWith ( '+++' ) )
163
+ if ( lastHeaderLineIndex === - 1 ) return resultDict // ignore binary files
164
+
163
165
const plainDiff = lines . slice ( lastHeaderLineIndex + 1 ) . join ( '\n' ) . trim ( )
164
166
let filePath = ''
165
167
if ( lines [ lastHeaderLineIndex ] . startsWith ( '+++ b/' ) ) { // every file except removed files
You canβt perform that action at this time.
0 commit comments