better git diff parsing

Review Request #250 — Created Feb. 14, 2008 and submitted — Latest diff uploaded

Information

Review Board SVN (deprecated)
trunk

Reviewers

The GitDiffParser class doesn't cope well with some git specific items in a diff. For example:

 * a new file with no actual content added, therefore no 'differences' in conventional diff sense
 * a filemode only change (git tracks the exe file mode bit) with no content change

The present parser skips over the first item above in a manner in a hacked-around manner. The second item above will make the diff parsing choke and die. 

The code here could be made to look a bit more prettier, but copes with those two cases above quite well. It now skips over both items (if they are present in a diff) without leaving artifacts (the old parser would add the new file lines to the next diff section, and would die if the diff was just the newfile with no content).

Later on it would be good to be able to display these circumstances to the reviewer (that there is a new file with no content or a filemode only change), but for now at least the parser will not longer choke under certain circumstances.
Existing tests pass, and new ones were added for edge cases of parsing