Skip to content

Commit

Permalink
Merge pull request #3 from bill-rich/update_binary_marker
Browse files Browse the repository at this point in the history
Add "Binary files .* differ" marker
  • Loading branch information
zricethezav committed Apr 5, 2022
2 parents 464ab5f + 496604b commit 9c699f1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions gitdiff/binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ func (p *parser) ParseBinaryFragments(f *File) (n int, err error) {
}

func (p *parser) ParseBinaryMarker() (isBinary bool, hasData bool, err error) {
switch p.Line(0) {
case "GIT binary patch\n":
line := p.Line(0)
switch {
case line == "GIT binary patch\n":
hasData = true
case "Binary files differ\n":
case "Files differ\n":
case line == "Binary files differ\n":
case line == "Files differ\n":
case strings.HasPrefix(line, "Binary files ") && strings.HasSuffix(line, "differ\n"):
default:
if !binaryRegexp.MatchString(p.Line(0)) {
return false, false, nil
Expand Down

0 comments on commit 9c699f1

Please sign in to comment.