diff --git a/src/__fixtures__/changed-binary-file b/src/__fixtures__/changed-binary-file index 057d89c..80331d2 100644 --- a/src/__fixtures__/changed-binary-file +++ b/src/__fixtures__/changed-binary-file @@ -1,3 +1,6 @@ diff --git a/file1 b/file1 index 21be030..9443748 100644 -Binary files a/file1 and b/file1 differ \ No newline at end of file +Binary files a/file1 and b/file1 differ +diff --git a/file1 b/file2 +index 21be030..9443748 100644 +Binary files a/file1 and b/file2 differ \ No newline at end of file diff --git a/src/__tests__/__snapshots__/changed-binary-file.test.ts.snap b/src/__tests__/__snapshots__/changed-binary-file.test.ts.snap index a6c44d9..3083727 100644 --- a/src/__tests__/__snapshots__/changed-binary-file.test.ts.snap +++ b/src/__tests__/__snapshots__/changed-binary-file.test.ts.snap @@ -14,6 +14,17 @@ exports[`changed binary file parse \`changed-binary-file\` 1`] = ` "path": "file1", "type": "ChangedFile", }, + { + "chunks": [ + { + "pathAfter": "file2", + "pathBefore": "file1", + "type": "BinaryFilesChunk", + }, + ], + "path": "file2", + "type": "ChangedFile", + }, ], "type": "GitDiff", } diff --git a/src/parse-git-diff.ts b/src/parse-git-diff.ts index b6fad3b..f7c7dad 100644 --- a/src/parse-git-diff.ts +++ b/src/parse-git-diff.ts @@ -117,7 +117,7 @@ function parseFileChange(ctx: Context): AnyFileChange | undefined { } else if ( chunks.length && chunks[0].type === 'BinaryFilesChunk' && - chunks[0].pathAfter === chunks[0].pathBefore + chunks[0].pathAfter ) { return { type: FileType.Changed,