• 
      

    Preserve form feed characters in diffs.

    Review Request #6839 — Created Jan. 29, 2015 and submitted — Latest diff uploaded

    Information

    Review Board
    release-2.0.x
    7314dcc...

    Reviewers

    Unicode strings treat form feed characters as newlines when calling
    splitlines(). This behavior doesn't match byte strings, and definitely
    doesn't match patch's logic. Form feed characters, from patch and diff's
    point of view, are valid characters like any other, and only \r and
    \n should be used as line endings.

    We now have our own string splitting function that looks for the
    patterns of newlines that we and patch support. This gives us more
    specific, testable behavior that won't vary based on the underlying
    string type or encoding.

    Added a unit test, which passes (along with all other tests).

    Tested with a diff containing a form feed character. Previously, it would
    turn into a newline, corrupting the diff and angering patch. After, the
    character was preserved and came along with the patch.

    Went through nearly all my local review requests containing diffs. None of them
    broke.