aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-03-05 15:43:48 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2020-03-05 15:44:42 +0100
commitfb0858e9c95472b213f8c0530c1959310e88f4b6 (patch)
tree7bdeec18056f8029010f4e3b4dd988990b198058 /org.eclipse.jgit.test/tst/org
parentd7f304045af2f602c5b0c1a26d2c7f643753cf8f (diff)
parent241557137070d680cf730ba1633df5e4c4266a1d (diff)
downloadjgit-fb0858e9c95472b213f8c0530c1959310e88f4b6.tar.gz
jgit-fb0858e9c95472b213f8c0530c1959310e88f4b6.zip
Merge branch 'stable-5.6'
* stable-5.6: Silence API errors introduced by 093fbbd1 Bump Bazel version to 2.2.0 Expose FileStoreAttributes.setBackground() Update reftable storage repo layout Change-Id: I237eaaed7991e8bbd56a7624f47bbba985330026 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableTest.java42
1 files changed, 34 insertions, 8 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableTest.java
index b13cdb9fec..33bacbe3e2 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableTest.java
@@ -92,11 +92,6 @@ public class FileReftableTest extends SampleDataRepositoryTestCase {
}
@Test
- public void additionalRefsAreRemoved() {
- assertFalse(new File(db.getDirectory(), Constants.HEAD).exists());
- }
-
- @Test
public void testCompactFully() throws Exception {
ObjectId c1 = db.resolve("master^^");
ObjectId c2 = db.resolve("master^");
@@ -108,9 +103,16 @@ public class FileReftableTest extends SampleDataRepositoryTestCase {
}
File tableDir = new File(db.getDirectory(), Constants.REFTABLE);
- assertTrue(tableDir.listFiles().length > 1);
+ assertTrue(tableDir.listFiles().length > 2);
((FileReftableDatabase)db.getRefDatabase()).compactFully();
- assertEquals(tableDir.listFiles().length,1);
+ assertEquals(tableDir.listFiles().length,2);
+ }
+
+ @Test
+ public void testOpenConvert() throws Exception {
+ try (FileRepository repo = new FileRepository(db.getDirectory())) {
+ assertTrue(repo.getRefDatabase() instanceof FileReftableDatabase);
+ }
}
@Test
@@ -129,7 +131,7 @@ public class FileReftableTest extends SampleDataRepositoryTestCase {
@Test
public void testConvertToRefdir() throws Exception {
- db.convertToPackedRefs(false);
+ db.convertToPackedRefs(false, false);
assertTrue(db.getRefDatabase() instanceof RefDirectory);
Ref h = db.exactRef("HEAD");
assertTrue(h.isSymbolic());
@@ -144,6 +146,30 @@ public class FileReftableTest extends SampleDataRepositoryTestCase {
}
@Test
+ public void testConvertToRefdirReflog() throws Exception {
+ Ref a = db.exactRef("refs/heads/a");
+ String aCommit = a.getObjectId().getName();
+ RefUpdate u = db.updateRef("refs/heads/master");
+ u.setForceUpdate(true);
+ u.setNewObjectId(ObjectId.fromString(aCommit));
+ u.setForceRefLog(true);
+ u.setRefLogMessage("apple", false);
+ u.update();
+
+ RefUpdate v = db.updateRef("refs/heads/master");
+ v.setForceUpdate(true);
+ v.setNewObjectId(ObjectId.fromString(bCommit));
+ v.setForceRefLog(true);
+ v.setRefLogMessage("banana", false);
+ v.update();
+
+ db.convertToPackedRefs(true, false);
+ List<ReflogEntry> logs = db.getReflogReader("refs/heads/master").getReverseEntries(2);
+ assertEquals(logs.get(0).getComment(), "banana");
+ assertEquals(logs.get(1).getComment(), "apple");
+ }
+
+ @Test
public void testBatchrefUpdate() throws Exception {
ObjectId cur = db.resolve("master");
ObjectId prev = db.resolve("master^");