|
|
@ -48,6 +48,7 @@ import static org.junit.Assert.assertSame; |
|
|
|
import static org.junit.Assert.assertTrue; |
|
|
|
import static org.junit.Assert.assertTrue; |
|
|
|
import static org.junit.Assert.fail; |
|
|
|
import static org.junit.Assert.fail; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import org.eclipse.jgit.diff.DiffEntry.ChangeType; |
|
|
|
import org.eclipse.jgit.diff.DiffEntry.ChangeType; |
|
|
@ -226,6 +227,19 @@ public class RenameDetectorTest extends RepositoryTestCase { |
|
|
|
assertCopy(d, b, 100, entries.get(2)); |
|
|
|
assertCopy(d, b, 100, entries.get(2)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testExactRename_UnstagedFile() throws Exception { |
|
|
|
|
|
|
|
ObjectId aId = blob("foo"); |
|
|
|
|
|
|
|
DiffEntry a = DiffEntry.delete(PATH_A, aId); |
|
|
|
|
|
|
|
DiffEntry b = DiffEntry.add(PATH_B, aId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rd.addAll(Arrays.asList(a, b)); |
|
|
|
|
|
|
|
List<DiffEntry> entries = rd.compute(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals(1, entries.size()); |
|
|
|
|
|
|
|
assertRename(a, b, 100, entries.get(0)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testInexactRename_OnePair() throws Exception { |
|
|
|
public void testInexactRename_OnePair() throws Exception { |
|
|
|
ObjectId aId = blob("foo\nbar\nbaz\nblarg\n"); |
|
|
|
ObjectId aId = blob("foo\nbar\nbaz\nblarg\n"); |
|
|
@ -429,6 +443,23 @@ public class RenameDetectorTest extends RepositoryTestCase { |
|
|
|
assertSame(b, entries.get(1)); |
|
|
|
assertSame(b, entries.get(1)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testNoRenames_UntrackedFile() throws Exception { |
|
|
|
|
|
|
|
ObjectId aId = blob("foo"); |
|
|
|
|
|
|
|
ObjectId bId = ObjectId |
|
|
|
|
|
|
|
.fromString("3049eb6eee7e1318f4e78e799bf33f1e54af9cbf"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DiffEntry a = DiffEntry.delete(PATH_A, aId); |
|
|
|
|
|
|
|
DiffEntry b = DiffEntry.add(PATH_B, bId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rd.addAll(Arrays.asList(a, b)); |
|
|
|
|
|
|
|
List<DiffEntry> entries = rd.compute(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals(2, entries.size()); |
|
|
|
|
|
|
|
assertSame(a, entries.get(0)); |
|
|
|
|
|
|
|
assertSame(b, entries.get(1)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testBreakModify_BreakAll() throws Exception { |
|
|
|
public void testBreakModify_BreakAll() throws Exception { |
|
|
|
ObjectId aId = blob("foo"); |
|
|
|
ObjectId aId = blob("foo"); |
|
|
|