aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal
diff options
context:
space:
mode:
authorMinh Thai <mthai@google.com>2018-02-09 09:49:24 -0800
committerMinh Thai <mthai@google.com>2018-02-09 09:49:24 -0800
commit5efc3dcc6c9f5c93ba8b1f75b7070d3eb281f08d (patch)
treee63809baff7ebeb5aa3f12a0d113ab69840968e4 /org.eclipse.jgit.test/tst/org/eclipse/jgit/internal
parent4d5231f0013d2b5239f00277475d3804be38366d (diff)
downloadjgit-5efc3dcc6c9f5c93ba8b1f75b7070d3eb281f08d.tar.gz
jgit-5efc3dcc6c9f5c93ba8b1f75b7070d3eb281f08d.zip
MergedReftable to skip shadowed refs in same reftable
This would allow compact and GC process to clean up duplicate ref names in the reftables. Change-Id: I2b9df0bf72dba63cc3525e374982e60559a776c2 Signed-off-by: Minh Thai <mthai@google.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/internal')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/MergedReftableTest.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/MergedReftableTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/MergedReftableTest.java
index adba048e65..ec60bd9137 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/MergedReftableTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/MergedReftableTest.java
@@ -218,6 +218,27 @@ public class MergedReftableTest {
}
@Test
+ public void scanDuplicates() throws IOException {
+ List<Ref> delta1 = Arrays.asList(
+ ref("refs/heads/apple", 1),
+ ref("refs/heads/banana", 2));
+ List<Ref> delta2 = Arrays.asList(
+ ref("refs/heads/apple", 3),
+ ref("refs/heads/apple", 4));
+
+ MergedReftable mr = merge(write(delta1, 1000), write(delta2, 2000));
+ try (RefCursor rc = mr.allRefs()) {
+ assertTrue(rc.next());
+ assertEquals("refs/heads/apple", rc.getRef().getName());
+ assertEquals(id(3), rc.getRef().getObjectId());
+ assertTrue(rc.next());
+ assertEquals("refs/heads/banana", rc.getRef().getName());
+ assertEquals(id(2), rc.getRef().getObjectId());
+ assertFalse(rc.next());
+ }
+ }
+
+ @Test
public void scanIncludeDeletes() throws IOException {
List<Ref> delta1 = Arrays.asList(ref("refs/heads/next", 4));
List<Ref> delta2 = Arrays.asList(delete("refs/heads/next"));