-
Notifications
You must be signed in to change notification settings - Fork 49
MultiFileDiffReader returns trailing content #60
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
Oops, I need to fix the tests. |
344e8f4
to
60444fa
Compare
Codecov Report
@@ Coverage Diff @@
## master #60 +/- ##
==========================================
+ Coverage 73.82% 74.59% +0.77%
==========================================
Files 4 4
Lines 424 429 +5
==========================================
+ Hits 313 320 +7
+ Misses 63 62 -1
+ Partials 48 47 -1
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.
Hmm, I'm not sure yet. This seems a bit brittle and based on implicit side effects.
If I understand it correctly what's happening is that any non-diff content is parsed as "extended headers" into the next diff. But since there is no next diff an error is returned. Right?
What happens if non-diff content is found between two valid diffs? Or before the first diff -won't this break in those case?
Setting "request changes" here because at the very least we're going to need some tests :)
Another idea might be to make this API explicit by adding another new method to |
Yes, this is my mental model of what the existing behaviour is, mostly unchanged by this PR.
I might be using the wrong terminology because of unfamiliarity with this codebase, but AFAIK non-diff content is indistinguishable from extended headers. "non-diff" content at the start of a file, or before a valid diff, will be parsed as extended headers for the following diff. This PR doesn't change any of that - it causes an additional "diff" to be returned at the end with trailing content. Totally fair comments about brittleness. I can (and will) fix the brittleness aspect with tests, I just wanted to put something in front of maintainer eyes as quickly as possible before spending a lot of time on the idea. @mrnugget re: adding another method, I can do that if you'd prefer. I was avoiding breaking the API, but extending it seems fine. I can push something that does this. |
60444fa
to
5f1f8d0
Compare
5f1f8d0
to
3d94e7d
Compare
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.
Thanks for adding the tests!
Left a comment, because I think we can maybe make the test case clearer, but not 100% sure.
Along with EOF. This is useful for handling mixed diff and non-diff output. Note that "stray" content between diff files was already included in the extended headers for the next diff. To avoid breaking the existing API, this trailing content is only available in a new method.
3d94e7d
to
b8a97d3
Compare
Thanks for this! Feel free to hit the merge button once tests pass. Edit: Woops, realised that we can only do that. So I'll do that once it's green :D |
Thanks! |
Along with EOF. This is useful for handling mixed diff and non-diff
output. Note that "stray" content between diff files was already
included in the extended headers for the next diff. All this commit does
is return a partial FileDiff, with only extended headers and no actual
diff content, along with an EOF.
Fixes #59