-
Notifications
You must be signed in to change notification settings - Fork 49
Handle rename-and-mode-change in empty file diffs & clean up code #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #58 +/- ##
==========================================
- Coverage 75.11% 73.82% -1.30%
==========================================
Files 4 4
Lines 446 424 -22
==========================================
- Hits 335 313 -22
Misses 63 63
Partials 48 48
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests seem to pass, so I trust the conditions from before mapped to the same behavior 🤷♂️
fd.NewName = "/dev/null" | ||
} | ||
|
||
return true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function is finally readable, thanks so much!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be much better, but I had a lot of trouble introducing names for the reused-conditions (lineCount == 3
) that wouldn't be confusing, so stopped. Maybe in the future we should revisit this.
Yeah. The tests cover this pretty well, I think. And I added a test for a missing case. So I'm confident that nothing broke. |
This is a bit of a follow-up to #57 in that it adds another test for file mode changes, in which a file's mode has changed and it has been renamed. I also duplicated the test added in #57 for single file diffs, so these tests are next to each other.
Besides that I used
t.Run
in the the two test functions I was working with to make it easier to see which test is failing and I tried to clean up the parsing code as best as I could. Tests helped a lot here.