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 a246ac9e9..0a03fc352 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 @@ -329,21 +329,21 @@ public class MergedReftableTest { public void overlappedUpdateIndices() throws IOException { ByteArrayOutputStream buf = new ByteArrayOutputStream(); ReftableWriter writer = new ReftableWriter(buf) - .setMinUpdateIndex(1) - .setMaxUpdateIndex(3) + .setMinUpdateIndex(2) + .setMaxUpdateIndex(4) .begin(); - writer.writeRef(ref("refs/heads/a", 1), 1); - writer.writeRef(ref("refs/heads/b", 2), 3); + writer.writeRef(ref("refs/heads/a", 10), 2); + writer.writeRef(ref("refs/heads/b", 20), 4); writer.finish(); byte[] base = buf.toByteArray(); buf = new ByteArrayOutputStream(); writer = new ReftableWriter(buf) - .setMinUpdateIndex(2) - .setMaxUpdateIndex(4) + .setMinUpdateIndex(1) + .setMaxUpdateIndex(3) .begin(); - writer.writeRef(ref("refs/heads/a", 10), 2); - writer.writeRef(ref("refs/heads/b", 20), 4); + writer.writeRef(ref("refs/heads/a", 1), 1); + writer.writeRef(ref("refs/heads/b", 2), 3); writer.finish(); byte[] delta = buf.toByteArray(); @@ -368,21 +368,21 @@ public class MergedReftableTest { public void enclosedUpdateIndices() throws IOException { ByteArrayOutputStream buf = new ByteArrayOutputStream(); ReftableWriter writer = new ReftableWriter(buf) - .setMinUpdateIndex(1) - .setMaxUpdateIndex(4) + .setMinUpdateIndex(2) + .setMaxUpdateIndex(3) .begin(); - writer.writeRef(ref("refs/heads/a", 1), 1); - writer.writeRef(ref("refs/heads/b", 20), 4); + writer.writeRef(ref("refs/heads/a", 10), 2); + writer.writeRef(ref("refs/heads/b", 2), 3); writer.finish(); byte[] base = buf.toByteArray(); buf = new ByteArrayOutputStream(); writer = new ReftableWriter(buf) - .setMinUpdateIndex(2) - .setMaxUpdateIndex(3) + .setMinUpdateIndex(1) + .setMaxUpdateIndex(4) .begin(); - writer.writeRef(ref("refs/heads/a", 10), 2); - writer.writeRef(ref("refs/heads/b", 2), 3); + writer.writeRef(ref("refs/heads/a", 1), 1); + writer.writeRef(ref("refs/heads/b", 20), 4); writer.finish(); byte[] delta = buf.toByteArray(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java index 36335153a..a78f4d24d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java @@ -82,7 +82,7 @@ public class MergedReftable extends Reftable { return 0; } long minUpdateIndex = tables[0].minUpdateIndex(); - for (int i = 0; i < tables.length - 1; i++) { + for (int i = 1; i < tables.length; i++) { if (tables[i].minUpdateIndex() < minUpdateIndex) { minUpdateIndex = tables[i].minUpdateIndex(); }