Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion gitdiff/binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ func (p *parser) ParseBinaryMarker() (isBinary bool, hasData bool, err error) {
case "Binary files differ\n":
case "Files differ\n":
default:
return false, false, nil
if strings.HasPrefix(p.Line(0), "Binary files") && strings.HasSuffix(p.Line(0), "differ\n") {
// for some git version, it comes as "Binary files {filepath} differ\n"
} else {
return false, false, nil
}
}

if err = p.Next(); err != nil && err != io.EOF {
Expand Down
5 changes: 5 additions & 0 deletions gitdiff/binary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ func TestParseBinaryMarker(t *testing.T) {
IsBinary: true,
HasData: false,
},
"binaryFileNoPatch2": {
Input: "Binary files path/to/the/file differ\n",
IsBinary: true,
HasData: false,
},
"textFile": {
Input: "@@ -10,14 +22,31 @@\n",
IsBinary: false,
Expand Down