Fix changes to lines starting with '-- ' with git-svn and git-p4.

Review Request #6829 — Created Jan. 23, 2015 and submitted — Latest diff uploaded

Information

RBTools
release-0.6.x
56cdd89...

Reviewers

When we are using git-svn or git-p4, we post-process the diff to change it from
something that looks like a git diff to something that looks like a subversion
diff or perforce diff.

This works most of the time, but our handling of the index lines had some
unintended consequences. If the file in question had a change to a line
starting with two hyphens and a space ('-- '), then the unified diff will
represent that as '--- old text / '+-- new text'. Since we only looked for
'--- filename' when scanning for file headers, we'd modify these lines that
were actually content, and the patch would fail to apply. I've changed this to
make sure that we only munge a line starting with '--- ' if the line after it
starts with '+++ '.

It's still possible to break this by changing a single line from '-- ...' to
'++ ...' but that should hopefully be a vanishingly small case, and I suspect
it will also break every other tool that handles diff files.

Manually tested git-svn and git-p4 cases. We don't have any unit tests for
these setups. Ran existing unit tests.

    Loading...