Make our diff parsing more flexible with regards to "Index:" lines.

Review Request #8851 — Created March 27, 2017 and submitted — Latest diff uploaded

Information

Review Board
release-2.5.x
1f2ed9f...

Reviewers

The "Index:" lines, often used in diffs to help give a stable filename
and a starting location to metadata for a diff, would historically come
right before a 67-character "====..." divider. However, this is not true
with all types of diffs. Some tools (such as WebStorm) like to inject
additional information in-between the "Index:" line and the divider, and
our parsing ends up ignoring the "Index:" line as anything special,
causing parsing issues for the remainder of that file's metadata, and
causing some of it to merge into the previous file or to be thrown away.

This change improves our parsing for this. Instead of assuming the
divider comes immediately after the index, we now look ahead for it. If
we find it before any unified diff data, then we accept the Index line,
and safely mark the location of the diff data. If we don't find the
divider, then we don't treat it as special.

This should help us to stay compatible with third-party diff tools that
inject custom metadata, without having to support each tool
individually.

All unit tests pass.