-
Notifications
You must be signed in to change notification settings - Fork 510
Split diffs based on file headers instead of 'Index:' metadata #88
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
Changes from 4 commits
acb20d3
a4178de
41e3e29
e9a40c3
3ab1df8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,8 +248,8 @@ Index: test2 | |
}); | ||
it('should throw on invalid input in strict mode', function() { | ||
expect(function() { | ||
parsePatch('Index: foo\nfoo', {strict: true}); | ||
}).to['throw'](/Unknown line 2 "foo"/); | ||
parsePatch('Index: foo\n+++ bar\nblah', {strict: true}); | ||
}).to['throw'](/Unknown line 3 "blah"/); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I said positive case, I meant create a new test case that would be failing without the changes above. Basically I'd like to see a TDD artifact here so we both have a example of what this change fixes if someone looks back on this in the future. This also help protect yourself as it ensures that your use case doesn't regress in the future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I missed the point. I've added a test to check |
||
}); | ||
}); | ||
}); |
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.
More restrictive than before. Why?
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.
To prevent the case where the line start with @@whatever, that in strict mode it should throw an error instead of think it's a new hunk.
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.
Relax both this and the changes down below. This is not a spec we are dealing with but a bunch of random projects that are hobbled together based on arbitrary documentation. We should follow Postel's law here.
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.
I think we should follow the spec and the projects bad using it should fix themselves because being less restrictive here would lead to errors otherwise, but since we already are accepting hunks without file headers (that's not supported by the standard, but there's no technical issues for accept it) and there's other projects using the library that would break, I'll remove the
\s
.