summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-12-05 01:31:32 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2019-12-05 01:31:32 +0100
commit08d4c63b6dffd6f2314f7ec6de24c1dd9070a44b (patch)
tree9080443f7412e05d71926d86980c4e5fb96ddc24 /org.eclipse.jgit.test/tst/org
parent3ca340d5daea9d33fbfb08d4af6e2d851d90cf52 (diff)
parent5185d288c11171a21a3057f0df906782493d0b39 (diff)
downloadjgit-08d4c63b6dffd6f2314f7ec6de24c1dd9070a44b.tar.gz
jgit-08d4c63b6dffd6f2314f7ec6de24c1dd9070a44b.zip
Merge branch 'stable-5.6'
* stable-5.6: Introduce RefDatabase#hasFastTipsWithSha1 Update Orbit to R20191126223242 for 2019-12 Prepare 5.6.0-SNAPSHOT builds JGit v5.6.0.201912041214-rc1 Prepare 5.6.0-SNAPSHOT builds JGit v5.6.0.201911271000-m3 Change-Id: Id33b054131bbcd27a0ae7200f564775049698d2c
Diffstat (limited to 'org.eclipse.jgit.test/tst/org')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableTest.java4
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java66
2 files changed, 70 insertions, 0 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 0e06d459a2..cdc64fa1b2 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
@@ -155,6 +155,8 @@ public class FileReftableTest extends SampleDataRepositoryTestCase {
assertFalse(b.isSymbolic());
assertTrue(b.isPeeled());
assertEquals(bCommit, b.getObjectId().name());
+
+ assertTrue(db.getRefDatabase().hasFastTipsWithSha1());
}
@Test
@@ -169,6 +171,8 @@ public class FileReftableTest extends SampleDataRepositoryTestCase {
assertFalse(b.isSymbolic());
assertTrue(b.isPeeled());
assertEquals(bCommit, b.getObjectId().name());
+
+ assertFalse(db.getRefDatabase().hasFastTipsWithSha1());
}
@Test
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java
index 45e6c7d128..daf540c413 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java
@@ -177,6 +177,67 @@ public class ReftableTest {
}
@Test
+ public void hasObjMapRefs() throws IOException {
+ ArrayList<Ref> refs = new ArrayList<>();
+ refs.add(ref(MASTER, 1));
+ byte[] table = write(refs);
+ ReftableReader t = read(table);
+ assertTrue(t.hasObjectMap());
+ }
+
+ @Test
+ public void hasObjMapRefsSmallTable() throws IOException {
+ ArrayList<Ref> refs = new ArrayList<>();
+ ReftableConfig cfg = new ReftableConfig();
+ cfg.setIndexObjects(false);
+ refs.add(ref(MASTER, 1));
+ byte[] table = write(refs);
+ ReftableReader t = read(table);
+ assertTrue(t.hasObjectMap());
+ }
+
+ @Test
+ public void hasObjLogs() throws IOException {
+ PersonIdent who = new PersonIdent("Log", "Ger", 1500079709, -8 * 60);
+ String msg = "test";
+ ReftableConfig cfg = new ReftableConfig();
+ cfg.setIndexObjects(false);
+
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ReftableWriter writer = new ReftableWriter(buffer)
+ .setMinUpdateIndex(1)
+ .setConfig(cfg)
+ .setMaxUpdateIndex(1)
+ .begin();
+
+ writer.writeLog("master", 1, who, ObjectId.zeroId(), id(1), msg);
+ writer.finish();
+ byte[] table = buffer.toByteArray();
+
+ ReftableReader t = read(table);
+ assertTrue(t.hasObjectMap());
+ }
+
+ @Test
+ public void hasObjMapRefsNoIndexObjects() throws IOException {
+ ArrayList<Ref> refs = new ArrayList<>();
+ ReftableConfig cfg = new ReftableConfig();
+ cfg.setIndexObjects(false);
+ cfg.setRefBlockSize(256);
+ cfg.setAlignBlocks(true);
+
+ // Fill up 5 blocks.
+ int N = 256 * 5 / 25;
+ for (int i= 0; i < N; i++) {
+ refs.add(ref(String.format("%02d/xxxxxxxxxx", i), i));
+ }
+ byte[] table = write(refs, cfg);
+
+ ReftableReader t = read(table);
+ assertFalse(t.hasObjectMap());
+ }
+
+ @Test
public void oneIdRef() throws IOException {
Ref exp = ref(MASTER, 1);
byte[] table = write(exp);
@@ -936,8 +997,13 @@ public class ReftableTest {
}
private byte[] write(Collection<Ref> refs) throws IOException {
+ return write(refs, new ReftableConfig());
+ }
+
+ private byte[] write(Collection<Ref> refs, ReftableConfig cfg) throws IOException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
stats = new ReftableWriter(buffer)
+ .setConfig(cfg)
.begin()
.sortAndWriteRefs(refs)
.finish()