3495: make_svn_diff() in rbtools/clients/git.py can generate corrupt diffs if you are editing a file that has lines starting with "-- "

nux***@gmai***** (Google Code) (Is this you? Claim this profile.)
david
david
Jan. 29, 2015
What version are you running?

RBtools 0.6.2 (discovered under 0.5.2)

What's the URL of the page containing the problem?

Its not a page, its rbtools

What steps will reproduce the problem?
1. Have a git-svn repo
2. Try to post a diff that includes a file with a change on a line that already starts with "-- " or "++ "
3. When converting the diff from git to svn format, rbtools appends "(revision NNN)" to those lines breaking the diff.

I discovered this posting a diff for an SNMP MIB which often contain lines that start with "-- "

What is the expected output? What do you see instead?

Not to append "(revision NNNN)" to those lines.

What operating system are you using? What browser?

Iceweasel 30 on Debian Sid

Please provide any additional information below.

The bug appears to be in clients/git.py, it assumes any line start with "--- " is part of the diff header. But if a line in the real file starts with "-- " this sequence can occur outside of a header if that line is changed. Likewise for the "+++ " check below this.

https://github.com/reviewboard/rbtools/blob/master/rbtools/clients/git.py#L520

make_perforce_diff() below has the same issue and other diff conversion code made have a similar pitfall.
david
#1 david
  • +PendingReview
  • +Component-RBTools
  • +david
david
#2 david
Fixed in release-0.6.x (c0faa66). Thanks!
  • -PendingReview
    +Fixed