@@ -515,11 +515,6 @@ public void testHistory(boolean renamedHandling) throws Exception {
515
515
File root = new File (repository .getSourceRoot (), "git" );
516
516
GitRepository gitrepo = (GitRepository ) RepositoryFactory .getRepository (root );
517
517
518
- History history = gitrepo .getHistory (root );
519
- assertNotNull (history );
520
- assertNotNull (history .getHistoryEntries ());
521
- assertEquals (8 , history .getHistoryEntries ().size ());
522
-
523
518
List <HistoryEntry > entries = List .of (
524
519
new HistoryEntry ("84599b3c" , new Date (1485438707000L ),
525
520
"Kryštof Tulinger <[email protected] >" ,
null ,
@@ -553,29 +548,34 @@ public void testHistory(boolean renamedHandling) throws Exception {
553
548
"Trond Norbye <[email protected] >" ,
null ,
554
549
" Added a small test program\n \n " , true ,
555
550
Set .of ("/git/Makefile" , "/git/header.h" , "/git/main.c" )));
556
- History expectedHistory = new History (entries );
557
- assertEquals (expectedHistory , history );
558
551
552
+ List <String > expectedRenamedFiles = List .of ("moved/renamed2.c" , "moved2/renamed2.c" , "moved/renamed.c" );
553
+
554
+ History history = gitrepo .getHistory (root );
555
+ assertNotNull (history );
556
+ assertNotNull (history .getHistoryEntries ());
557
+ assertEquals (entries .size (), history .getHistoryEntries ().size ());
558
+
559
+ History expectedHistory ;
559
560
if (renamedHandling ) {
560
- assertNotNull (history .getRenamedFiles ());
561
- assertEquals (3 , history .getRenamedFiles ().size ());
562
-
563
- assertTrue (history .isRenamed ("moved/renamed2.c" ));
564
- assertTrue (history .isRenamed ("moved2/renamed2.c" ));
565
- assertTrue (history .isRenamed ("moved/renamed.c" ));
566
- assertFalse (history .isRenamed ("non-existent.c" ));
567
- assertFalse (history .isRenamed ("renamed.c" ));
561
+ expectedHistory = new History (entries , expectedRenamedFiles );
568
562
} else {
569
- assertEquals ( 0 , history . getRenamedFiles (). size () );
563
+ expectedHistory = new History ( entries );
570
564
}
565
+ assertEquals (expectedHistory , history );
571
566
572
567
// Retry with start changeset.
573
568
history = gitrepo .getHistory (root , "ce4c98ec" );
574
569
assertNotNull (history );
575
570
assertNotNull (history .getHistoryEntries ());
576
571
assertEquals (4 , history .getHistoryEntries ().size ());
577
- assertEquals (0 , history .getRenamedFiles ().size ());
578
- expectedHistory = new History (entries .subList (0 , 4 ));
572
+ if (renamedHandling ) {
573
+ expectedHistory = new History (entries .subList (0 , 4 ), expectedRenamedFiles );
574
+ assertEquals (expectedRenamedFiles .size (), history .getRenamedFiles ().size ());
575
+ } else {
576
+ expectedHistory = new History (entries .subList (0 , 4 ));
577
+ assertEquals (0 , history .getRenamedFiles ().size ());
578
+ }
579
579
assertEquals (expectedHistory , history );
580
580
}
581
581
0 commit comments