Fix parsing unified diff hunks with "No newline at end of file" markers.

Review Request #12578 — Created Sept. 4, 2022 and submitted

Information

DiffX
master

Reviewers

When parsing unified diff hunks, a "No newline at end of file" marker
found within content would be seen as garbage, causing a
MalformedHunkError to be raised. This could easily manifest when
generating stats for metadata sections.

The parser now handles these lines within a hunk. They're counted as
processed, but are otherwise ignored.

Unit tests pass.

Tested this with some repro cases we were sent. All parsing passed.

Summary ID
Fix parsing unified diff hunks with "No newline at end of file" markers.
When parsing unified diff hunks, a "No newline at end of file" marker found within content would be seen as garbage, causing a `MalformedHunkError` to be raised. This could easily manifest when generating stats for metadata sections. The parser now handles these lines within a hunk. They're counted as processed, but are otherwise ignored.
ab0d8d1345f58424e41032ddb5f05e6ffe3f01c9
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-1.x (ab3cab4)