summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorDave Borowitz <dborowitz@google.com>2018-05-30 09:18:12 -0700
committerDave Borowitz <dborowitz@google.com>2018-06-01 12:41:31 -0400
commit5c02ce52d6d746270e05c2fe7bb3478d3d937f53 (patch)
tree32437df253692788c6972ec017bbef038115ff40 /org.eclipse.jgit.test/tst
parent96512f5d3bdb904b33ad4aa9a55d07889d27eb5b (diff)
downloadjgit-5c02ce52d6d746270e05c2fe7bb3478d3d937f53.tar.gz
jgit-5c02ce52d6d746270e05c2fe7bb3478d3d937f53.zip
Allow overriding DfsPackDescription comparator for scanning packs
Provide a factory for comparators that use the default heuristics except with a different ordering of PackSources. Change-Id: I0809b64deb3d0486040076946fdbdad650d69240
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsPackDescriptionTest.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsPackDescriptionTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsPackDescriptionTest.java
index 6029e9cae8..55e1a9c4cc 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsPackDescriptionTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsPackDescriptionTest.java
@@ -46,8 +46,10 @@ package org.eclipse.jgit.internal.storage.dfs;
import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.COMPACT;
import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.GC;
import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.GC_REST;
+import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.GC_TXN;
import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.INSERT;
import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.RECEIVE;
+import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.UNREACHABLE_GARBAGE;
import static org.eclipse.jgit.internal.storage.pack.PackExt.INDEX;
import static org.eclipse.jgit.internal.storage.pack.PackExt.PACK;
import static org.junit.Assert.assertEquals;
@@ -102,6 +104,24 @@ public final class DfsPackDescriptionTest {
}
@Test
+ public void objectLookupComparatorCustomPackSourceComparator()
+ throws Exception {
+ DfsPackDescription a = create(GC);
+
+ DfsPackDescription b = create(COMPACT);
+
+ assertComparesLessThan(DfsPackDescription.objectLookupComparator(), b, a);
+ assertComparesLessThan(
+ DfsPackDescription.objectLookupComparator(
+ new PackSource.ComparatorBuilder()
+ .add(GC)
+ .add(INSERT, RECEIVE, GC_REST, GC_TXN, UNREACHABLE_GARBAGE)
+ .add(COMPACT)
+ .build()),
+ a, b);
+ }
+
+ @Test
public void objectLookupComparatorGcFileSize() throws Exception {
// a is older and smaller.
DfsPackDescription a = create(GC_REST);