aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file
diff options
context:
space:
mode:
authorKevin Sawicki <kevin@github.com>2011-12-19 09:14:47 -0800
committerKevin Sawicki <kevin@github.com>2011-12-19 09:14:47 -0800
commit1dcb76739c626d368cecaceb10d96b517a479f92 (patch)
treec67de96e3e447430df555547db3b1a8a6bb43173 /org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file
parent656461a9919403755b34b5dcd261a0f42750369d (diff)
downloadjgit-1dcb76739c626d368cecaceb10d96b517a479f92.tar.gz
jgit-1dcb76739c626d368cecaceb10d96b517a479f92.zip
Support getting specific entry number in reflog
The number specified is interpreted as relative to the last entry in the reflog. Change-Id: Ie4dd03370bb0d475a0e89d3015113ca98920100f
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ReflogReaderTest.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ReflogReaderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ReflogReaderTest.java
index c0cc0c3b7a..f3a6914bee 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ReflogReaderTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ReflogReaderTest.java
@@ -229,6 +229,42 @@ public class ReflogReaderTest extends SampleDataRepositoryTestCase {
assertEquals("new/work", checkout.getFromBranch());
}
+ @Test
+ public void testSpecificEntryNumber() throws Exception {
+ setupReflog("logs/refs/heads/master", twoLine);
+
+ ReflogReader reader = new ReflogReader(db, "refs/heads/master");
+ ReflogEntry e = reader.getReverseEntry(0);
+ assertEquals(
+ ObjectId.fromString("c6734895958052a9dbc396cff4459dc1a25029ab"),
+ e.getOldId());
+ assertEquals(
+ ObjectId.fromString("54794942a18a237c57a80719afed44bb78172b10"),
+ e.getNewId());
+ assertEquals("Same A U Thor", e.getWho().getName());
+ assertEquals("same.author@example.com", e.getWho().getEmailAddress());
+ assertEquals(60, e.getWho().getTimeZoneOffset());
+ assertEquals("2009-05-22T22:36:42", iso(e.getWho()));
+ assertEquals(
+ "rebase finished: refs/heads/rr/renamebranch5 onto c6e3b9fe2da0293f11eae202ec35fb343191a82d",
+ e.getComment());
+
+ e = reader.getReverseEntry(1);
+ assertEquals(
+ ObjectId.fromString("0000000000000000000000000000000000000000"),
+ e.getOldId());
+ assertEquals(
+ ObjectId.fromString("c6734895958052a9dbc396cff4459dc1a25029ab"),
+ e.getNewId());
+ assertEquals("A U Thor", e.getWho().getName());
+ assertEquals("thor@committer.au", e.getWho().getEmailAddress());
+ assertEquals(-60, e.getWho().getTimeZoneOffset());
+ assertEquals("2009-05-22T20:36:41", iso(e.getWho()));
+ assertEquals("branch: Created from rr/renamebranchv4", e.getComment());
+
+ assertNull(reader.getReverseEntry(3));
+ }
+
private void setupReflog(String logName, byte[] data)
throws FileNotFoundException, IOException {
File logfile = new File(db.getDirectory(), logName);