File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -21657,6 +21657,8 @@ class Git {
2165721657 return `\n${ string }`.split('\ndiff --git').slice(1).reduce((resultDict, fileDiff) => {
2165821658 const lines = fileDiff.split('\n')
2165921659 const lastHeaderLineIndex = lines.findIndex((line) => line.startsWith('+++'))
21660+ if (lastHeaderLineIndex === -1) return resultDict // ignore binary files
21661+
2166021662 const plainDiff = lines.slice(lastHeaderLineIndex + 1).join('\n').trim()
2166121663 let filePath = ''
2166221664 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 {
160160 return `\n${ string } ` . split ( '\ndiff --git' ) . slice ( 1 ) . reduce ( ( resultDict , fileDiff ) => {
161161 const lines = fileDiff . split ( '\n' )
162162 const lastHeaderLineIndex = lines . findIndex ( ( line ) => line . startsWith ( '+++' ) )
163+ if ( lastHeaderLineIndex === - 1 ) return resultDict // ignore binary files
164+
163165 const plainDiff = lines . slice ( lastHeaderLineIndex + 1 ) . join ( '\n' ) . trim ( )
164166 let filePath = ''
165167 if ( lines [ lastHeaderLineIndex ] . startsWith ( '+++ b/' ) ) { // every file except removed files
You canβt perform that action at this time.
0 commit comments