-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Monkey Patch git ruby gem #111
Monkey Patch git ruby gem #111
Conversation
Repro case:
Example output;
The reason it fails because the code at; https://github.com/schacon/ruby-git/blob/master/lib/git/diff.rb#L139-L151 expects the first line to contain the filename whereas raw diff comes back as;
|
Previously modulesync would throw an error when a file had a line ending warning emitted during a diff. This is common on cross platform modules. This commit monkey patches the git ruby gem to handle extra text before the actual diff contents. A monkey patch was used as the git ruby gem does not seem to be actively maintained, and it will some time before this issue is resolved and a new gem available. As the monkey_patch can contain code from other parties, which does not conform to module_sync's rubocopy styles, this file should is ignored explicitly in rubocops configuration.
c3eec28
to
55bd5ae
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.
I think we should open an issue to track this, to see when the git gem is patched and to pay down our tech debt.
full_diff_utf8_encoded = @full_diff.encode("UTF-8", "binary", { | ||
:invalid => :replace, | ||
:undef => :replace | ||
}) |
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.
Some funky alignment 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.
Yeah...That was a copy-n-paste from the git ruby gem. It has a combo of spaces and tabs :-( I was in two minds to fix it. I went with to keep it the same as the original as much as possible so it's easier to see where the patch is by comparing this code and the original.
However I'm happy to go through it and modify the alignments.
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.
If that's from the original it makes sense to keep it.
@rnelson0 Did you mean an issue on this repo or the git ruby gem? Already raised ruby-git/ruby-git#326 to track it. |
And I'm not a fan of monkey patching either, but I couldn't see any other way of getting this done without a major overhaul. This may also fix #45 too |
An issue on this gem, so we don't forget about it. |
Raised Issue #112 |
Thanks @rnelson0 ! |
Previously modulesync would throw an error when a file had a line ending warning
emitted during a diff. This is common on cross platform modules. This commit
monkey patches the git ruby gem to handle extra text before the actual diff
contents. A monkey patch was used as the git ruby gem does not seem to be
actively maintained, and it will some time before this issue is resolved and a
new gem available.
Git ruby gem issue is ruby-git/ruby-git#326