Skip to content

Conversation

@eseliger
Copy link
Member

@eseliger eseliger commented May 26, 2020

This adds support for parsing the cases in ./diff/testdata/sample_binary_inline.diff correctly.

@eseliger eseliger added the bug label May 26, 2020
@codecov
Copy link

codecov bot commented May 26, 2020

Codecov Report

Merging #46 into master will increase coverage by 0.18%.
The diff coverage is 62.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #46      +/-   ##
==========================================
+ Coverage   28.12%   28.31%   +0.18%     
==========================================
  Files           5        5              
  Lines        1152     1155       +3     
==========================================
+ Hits          324      327       +3     
+ Misses        784      783       -1     
- Partials       44       45       +1     
Impacted Files Coverage Δ
diff/parse.go 81.04% <62.50%> (+0.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c3ae63...75d7ce2. Read the comment docs.

Copy link
Member

@keegancsmith keegancsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. What happened previously in this code when diffing binary files? Do you need any special settings for git for this to work?

diff/parse.go Outdated
var err error
switch {
case (len(fd.Extended) == 3 || len(fd.Extended) == 4 && strings.HasPrefix(fd.Extended[3], "Binary files ")) &&
case (len(fd.Extended) == 3 || len(fd.Extended) == 4 && strings.HasPrefix(fd.Extended[3], "Binary files ") || len(fd.Extended) > 4 && strings.HasPrefix(fd.Extended[3], "GIT binary patch")) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this conditional is big enough and repeated enough to be factored out?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it smaller and replaced the common len check by a variable

@eseliger
Copy link
Member Author

Previously the file paths would be empty strings, now they are properly populated

@eseliger eseliger merged commit f935979 into master May 27, 2020
@eseliger eseliger deleted the es/binary-diffs branch May 27, 2020 11:49
@eseliger eseliger mentioned this pull request May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants