Fix some empty interdiffs resulting in a single equals chunk.

Review Request #6484 — Created Oct. 21, 2014 and submitted

Information

Review Board
release-2.0.x
26a60c9...

Reviewers

MyersDiffer had a bug where, if given an empty set of strings to
compare, it would yield an equal chunk. This could happen with
interdiffs when dealing with two deleted files, since both would end up
with empty strings.

The assumption was that if we reached the end of the processing and
haven't yielded anything, that it's an equal file. We'd then yield an
equal chunk with the ranges. In this case, the ranges would be 0,
causing index errors and bad assumptions later on. We now check for this
early and just bail.

Tested with some deleted files, which previously resulted in a single empty
chunk, causing an IndexError. After this, there were no chunks.

reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/diffviewer/myersdiff.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/diffviewer/myersdiff.py
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (4d27c68)
Loading...