-
Notifications
You must be signed in to change notification settings - Fork 25
Converting a patch into a diff #47
New issue
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No 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? No Sign in to your account
Comments
I think right now your options are the two things you described: parse the patch and then format it again, or split out the diff section with some external logic. The current structure of the parser makes it hard perform a split like this without parsing everything because it consumes the input as it finds matches. You also kind of have to parse every file fragment anyway to know for sure that a I think even if there was a function that returned the diff part as a string, it would probably be constructed internally by parsing the whole input and throwing out the structured result. I'll think about it some more, but on a first pass I didn't have any good ideas for implementing that. If you were willing to format a parsed patch, the |
Thanks for the reply! If File or Line had a #String method so at least that structure was correct I would be happy with parsing the entire patch and doing some for-loops. Also happy to help implement it |
I've started working on |
Nope, I don't care if it is byte-for-byte identical. Thanks for your help! |
The latest code on |
Hi!
I have a need to convert a patch into a normal diff, is there some functionality within this library that could facilitate that or do you have any recommendations?
I'd rather not parse the patch and then reconstruct it. I could parse out the header information and any trailing git version numbers at the bottom but I feel like this library already does most of that work.
Thanks!
The text was updated successfully, but these errors were encountered: