Fix "List index out of range" errors with interdiffing deleted files.
Review Request #6473 — Created Oct. 20, 2014 and submitted — Latest diff uploaded
It's possible to hit an IndexError when processing an interdiff between two
changes that delete a file. The wrinkle here is that between the two revisions
of the diff, some additional changes to that file were made (and synced to the
local developer's tree).The result of this is that we didn't filter out the file from the list of
things to show for the interdiff, and then things went wrong when we tried to
process the opcodes for diffing two empty strings.While I was doing this, I saw some warnings about a unicode-unaware comparison
occurring, so I've slipped the fix for that in as well. This doesn't actually
have any correctness implications, it just speeds up things slightly when
dealing with empty files.
- Created a reproduction case for the bug and tested before and after the
change. Before, I saw an entry for this file with the error inside. After,
the deleted files don't show up at all in the interdiff. - Ran unit tests.