Add better support for copied files in Git diffs.

We introduced support for moved files a while back, but copied files
were never properly supported. Copied files with 100% similarity would
flat-out break.

This change introduces support for parsing the copied file info from git
diffs, storing this state in the database, and showing it in the diff
viewer (just like we show moved files). It doesn't require any schema
modifications in the database.
Add better support for copied files in Git diffs.

We introduced support for moved files a while back, but copied files
were never properly supported. Copied files with 100% similarity would
flat-out break.

This change introduces support for parsing the copied file info from git
diffs, storing this state in the database, and showing it in the diff
viewer (just like we show moved files). It doesn't require any schema
modifications in the database.

This is the version for 1.7.x. A separate change will be made for 2.0,
since the code has changed enough since than to warrant some slightly
different changes.
Merge branch 'release-1.7.x' into release-2.0.x
Don't show move flags when changing whitespace on a line.

Whitespace-only changes on a line would result in a replace chunk that
could trigger move detection. This happened because we strip lines
before calculating moved lines, and didn't check that the same line was
modified, resulting in the line matching itself.

We now compare the offsets into the chunk to make sure that matched
lines aren't in the same location within the chunk. By this point, we
already know the content is matched after being stripped, so an offset
change should be sufficient to prevent this problem from occurring.
Improve indentation support when converting some tabs to spaces.

A diff was found where a line with 3 tabs was unindented 1 tab, had
1 tab removed, and had the last tab replaced with spaces. This caused
the unindentation to show 3 tabs removed, which was wrong.

To fix this, we have to have a little more state. We needed to know not
only the raw number of indentation characters that changed, but also the
normalized (tabs to spaces) difference in indentation between the lines.

With this information, the serializers could figure out when we've
actually hit the number of indentation normalized to spaces, in order to
stop processing the string. They then needed to be modified to return
the remaining portion along with the serialized version.

After this change, a more complex indentation change like
"\t\t\t" to "\t<8 spaces>" will show the right thing.
Merge branch 'release-2.0.x'