Fixed bug in scoring mechanism for rename detection
commite64cb0306507ce8a33d5f638cb4aa0ec9c1327ff
authorJeff Schumacher <jeffschu@google.com>
Tue, 3 Aug 2010 23:59:30 +0000 (3 16:59 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 4 Aug 2010 17:56:19 +0000 (4 10:56 -0700)
treebe57a49fff37fcad8a6ceaf48e97f87e6e584b80
parent395d2360582e2c11c9d4418f925860b5484d7a98
Fixed bug in scoring mechanism for rename detection

A bug in rename detection would cause file scores to be wrong. The
bug was due to the way rename detection would judge the similarity
between files. If file A has three lines containing 'foo', and file
B has 5 lines containing 'foo', the rename detection phase should
record that A and B have three lines in common (the minimum of the
number of times that line appears in both files). Instead, it would
choose the the number of times the line appeared in the destination
file, in this case file B. I fixed the bug by having the
SimilarityIndex instead choose the minimum number, as it should. I
also added a test case to verify that the bug had been fixed.

Change-Id: Ic75272a2d6e512a361f88eec91e1b8a7c2298d6b
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java
org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java