twaugh / patchutils

Manipulate patch files
GNU General Public License v2.0
139 stars 22 forks source link

Fixes for context<->unified conversion #10

Closed amonakov closed 9 years ago

amonakov commented 9 years ago

Hello,

(thanks for the quick response on the previous one!)

this pull request fixes conversion between context/unified formats. Functions do_convertto{unified,context} have a local variable 'got' that holds the length of 'line'. 'line' is updated in callees such as copy_...hunks and convert..hunksto..., but 'got' is updated only in copy_... callees, which appears to be an oversight. The first patch fixes the issue for context->unified conversion (which is where I observed the problem), and the second applies a similar fix to the unified->context counterpart.

twaugh commented 9 years ago

Thanks! Do you happen to have a test-case for this?

amonakov commented 9 years ago

I could write a test case for the first patch, but I don't have one ready. I observed the problem on a non-trivial context-style diff given to me privately

twaugh commented 9 years ago

OK, no problem. I'll merge this now as it is correct, and if you get to writing a test-case for it we can do that separately but no problem if not.