Fix Git diffs containing tabs after the filename.

Review Request #7397 — Created June 9, 2015 and submitted

Information

Review Board
release-2.0.x
58533e3...

Reviewers

We found a case where a user had a generated Git diff that contained
tabs after the filename, as if more data would follow. Our parser wasn't
expecting this, and ended up including the tab along with the filename.

Now, any extra whitespace around the filename is stripped away, allowing
the files to be properly matched against the repository.

The new unit test failed without the fix, and passed with it.

reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/tests.py
        reviewboard/scmtools/git.py
    
    
  2. 
      
david
  1. Hm. It's probably less likely, but what happens if the filenames actually end in a tab character or space?

    1. There's nothing we can really do about that, I don't think... Diffs are stupid.

      The broken diff from that one user who hit this looks like:

      --- <filename>\t
      +++ <filename>\t
      

      for each diff.

    2. OK. Ship it, I guess.

    3. I could alter this to only strip away the last \t, and ignore spaces?

    4. That sounds safer.

  2. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/tests.py
        reviewboard/scmtools/git.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (f7ac17f)