diff --git a/src/git.js b/src/git.js index e7c0cdf1..1911bd99 100644 --- a/src/git.js +++ b/src/git.js @@ -159,6 +159,8 @@ class Git { // split diff into separate entries for separate files. \ndiff --git should be a reliable way to detect the separation, as content of files is always indented return `\n${ string }`.split('\ndiff --git').slice(1).reduce((resultDict, fileDiff) => { const lines = fileDiff.split('\n') + if (lines.length === 0) return resultDict; // ignore binary files + const lastHeaderLineIndex = lines.findIndex((line) => line.startsWith('+++')) const plainDiff = lines.slice(lastHeaderLineIndex + 1).join('\n').trim() let filePath = ''