Skip to content

Commit 496604b

Browse files
committed
Add "Binary files .* differ" marker
1 parent 464ab5f commit 496604b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

gitdiff/binary.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ func (p *parser) ParseBinaryFragments(f *File) (n int, err error) {
5353
}
5454

5555
func (p *parser) ParseBinaryMarker() (isBinary bool, hasData bool, err error) {
56-
switch p.Line(0) {
57-
case "GIT binary patch\n":
56+
line := p.Line(0)
57+
switch {
58+
case line == "GIT binary patch\n":
5859
hasData = true
59-
case "Binary files differ\n":
60-
case "Files differ\n":
60+
case line == "Binary files differ\n":
61+
case line == "Files differ\n":
62+
case strings.HasPrefix(line, "Binary files ") && strings.HasSuffix(line, "differ\n"):
6163
default:
6264
if !binaryRegexp.MatchString(p.Line(0)) {
6365
return false, false, nil

0 commit comments

Comments
 (0)