diff: complete support for git patchid#5306
Merged
Merged
Conversation
Add a new 'print_index' flag to let the caller decide whether or not 'index <oid>..<oid>' should be printed. Since patch id needs not to have index when hashing a patch, it will be useful soon. Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com>
Git is generating patch-id using a stripped down version of a patch where hunk header and index information are not present. Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com>
When not shown binary data is added or removed in a patch, patch parser is currently returning 'error -1 - corrupt git binary header at line 4'. Fix it by correctly handling case where binary data is added/removed. Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com>
Member
pks-t
requested changes
Nov 28, 2019
Member
pks-t
left a comment
There was a problem hiding this comment.
Thanks a lot for your pull request! I like the changes quite a lot, they make the code simpler while still extending our support for patch IDs. I hate to say that my only issue is a stylistic one, so please forgive me, but please remove the braces around function invocations as they do not match our style. Other than that there was a needless call to git_buf_sanitize that I'd ask you to remove.
All in all, very well done and I'm happy to merge as soon as these two small issues are fixed!
Current implementation of patchid is not computing a correct patchid when given a patch where, for example, a new file is added or removed. Some more corner cases need to be handled to have same behavior as git patch-id command. Add some more tests to cover those corner cases. Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com>
Contributor
Author
|
Thanks for your nice feedback, happy to help :) |
pks-t
approved these changes
Nov 28, 2019
Member
|
Thanks a lot for this well-crafted pull request, @herrerog! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
I noticed that git_diff_patchid wasn't returning a correct hash in some cases.
So I fixed those and added some tests for it.
Please let me know what you think.
Thanks!