@ -43,7 +43,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
* /
package org.eclipse.jgit.lib ;
package org.eclipse.jgit.storage.file ;
import java.io.File ;
import java.io.IOException ;
@ -51,9 +51,22 @@ import java.util.List;
import java.util.Map ;
import java.util.Map.Entry ;
import org.eclipse.jgit.lib.Constants ;
import org.eclipse.jgit.lib.ObjectId ;
import org.eclipse.jgit.lib.PersonIdent ;
import org.eclipse.jgit.lib.Ref ;
import org.eclipse.jgit.lib.RefRename ;
import org.eclipse.jgit.lib.RefUpdate ;
import org.eclipse.jgit.lib.Repository ;
import org.eclipse.jgit.lib.SampleDataRepositoryTestCase ;
import org.eclipse.jgit.lib.RefUpdate.Result ;
import org.eclipse.jgit.revwalk.RevCommit ;
import org.eclipse.jgit.revwalk.RevWalk ;
import org.eclipse.jgit.storage.file.FileRepository ;
import org.eclipse.jgit.storage.file.LockFile ;
import org.eclipse.jgit.storage.file.RefDirectory ;
import org.eclipse.jgit.storage.file.RefDirectoryUpdate ;
import org.eclipse.jgit.storage.file.ReflogReader ;
public class RefUpdateTest extends SampleDataRepositoryTestCase {
@ -103,14 +116,14 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
assertNotSame ( newid , r . getObjectId ( ) ) ;
assertSame ( ObjectId . class , r . getObjectId ( ) . getClass ( ) ) ;
assertEquals ( newid . copy ( ) , r . getObjectId ( ) ) ;
List < org . eclipse . jgit . lib . ReflogReader . Entry > reverseEntries1 = db . getReflogReader ( "refs/heads/abc" ) . getReverseEntries ( ) ;
org . eclipse . jgit . lib . ReflogReader . Entry entry1 = reverseEntries1 . get ( 0 ) ;
List < org . eclipse . jgit . storage . file . ReflogReader . Entry > reverseEntries1 = db . getReflogReader ( "refs/heads/abc" ) . getReverseEntries ( ) ;
org . eclipse . jgit . storage . file . ReflogReader . Entry entry1 = reverseEntries1 . get ( 0 ) ;
assertEquals ( 1 , reverseEntries1 . size ( ) ) ;
assertEquals ( ObjectId . zeroId ( ) , entry1 . getOldId ( ) ) ;
assertEquals ( r . getObjectId ( ) , entry1 . getNewId ( ) ) ;
assertEquals ( new PersonIdent ( db ) . toString ( ) , entry1 . getWho ( ) . toString ( ) ) ;
assertEquals ( "" , entry1 . getComment ( ) ) ;
List < org . eclipse . jgit . lib . ReflogReader . Entry > reverseEntries2 = db . getReflogReader ( "HEAD" ) . getReverseEntries ( ) ;
List < org . eclipse . jgit . storage . file . ReflogReader . Entry > reverseEntries2 = db . getReflogReader ( "HEAD" ) . getReverseEntries ( ) ;
assertEquals ( 0 , reverseEntries2 . size ( ) ) ;
}
@ -326,7 +339,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
// the branch HEAD referred to is left untouched
assertEquals ( pid , db . resolve ( "refs/heads/master" ) ) ;
ReflogReader reflogReader = new ReflogReader ( db , "HEAD" ) ;
org . eclipse . jgit . lib . ReflogReader . Entry e = reflogReader . getReverseEntries ( ) . get ( 0 ) ;
org . eclipse . jgit . storage . file . ReflogReader . Entry e = reflogReader . getReverseEntries ( ) . get ( 0 ) ;
assertEquals ( pid , e . getOldId ( ) ) ;
assertEquals ( ppid , e . getNewId ( ) ) ;
assertEquals ( "GIT_COMMITTER_EMAIL" , e . getWho ( ) . getEmailAddress ( ) ) ;
@ -355,7 +368,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
// the branch HEAD referred to is left untouched
assertNull ( db . resolve ( "refs/heads/unborn" ) ) ;
ReflogReader reflogReader = new ReflogReader ( db , "HEAD" ) ;
org . eclipse . jgit . lib . ReflogReader . Entry e = reflogReader . getReverseEntries ( ) . get ( 0 ) ;
org . eclipse . jgit . storage . file . ReflogReader . Entry e = reflogReader . getReverseEntries ( ) . get ( 0 ) ;
assertEquals ( ObjectId . zeroId ( ) , e . getOldId ( ) ) ;
assertEquals ( ppid , e . getNewId ( ) ) ;
assertEquals ( "GIT_COMMITTER_EMAIL" , e . getWho ( ) . getEmailAddress ( ) ) ;
@ -677,9 +690,9 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
ObjectId oldHeadId = db . resolve ( Constants . HEAD ) ;
writeReflog ( db , oldfromId , oldfromId , "Just a message" ,
fromName ) ;
List < org . eclipse . jgit . lib . ReflogReader . Entry > oldFromLog = db
List < org . eclipse . jgit . storage . file . ReflogReader . Entry > oldFromLog = db
. getReflogReader ( fromName ) . getReverseEntries ( ) ;
List < org . eclipse . jgit . lib . ReflogReader . Entry > oldHeadLog = oldHeadId ! = null ? db
List < org . eclipse . jgit . storage . file . ReflogReader . Entry > oldHeadLog = oldHeadId ! = null ? db
. getReflogReader ( Constants . HEAD ) . getReverseEntries ( ) : null ;
assertTrue ( "internal check, we have a log" , new File ( db . getDirectory ( ) ,