]> source.dussan.org Git - jgit.git/commitdiff
reftable: test absense of prefix matching in Reflog 14/146814/15
authorHan-Wen Nienhuys <hanwen@google.com>
Tue, 30 Jul 2019 17:26:34 +0000 (19:26 +0200)
committerHan-Wen Nienhuys <hanwen@google.com>
Mon, 19 Aug 2019 09:40:28 +0000 (11:40 +0200)
Change-Id: I6705e6c57a8c080b17c7b93fdd598cf44a9d91c2
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java

index fc363ecf2f4b151e4092da95b2e6187c4670c186..b67ec563fde64661d801763d90b7fcf0d5d6665b 100644 (file)
@@ -567,6 +567,29 @@ public class ReftableTest {
                }
        }
 
+       @Test
+       public void reflogSeekPrefix() throws IOException {
+               PersonIdent who = new PersonIdent("Log", "Ger", 1500079709, -8 * 60);
+
+               ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+               ReftableWriter writer = new ReftableWriter()
+                       .setMinUpdateIndex(1)
+                       .setMaxUpdateIndex(1)
+                       .begin(buffer);
+
+               writer.writeLog("branchname", 1, who, ObjectId.zeroId(), id(1), "branchname");
+
+               writer.finish();
+               byte[] table = buffer.toByteArray();
+
+               ReftableReader t = read(table);
+               try (LogCursor c = t.seekLog("branch", Long.MAX_VALUE)) {
+                       // We find a reflog block, but the iteration won't confuse branchname
+                       // and branch.
+                       assertFalse(c.next());
+               }
+       }
+
        @Test
        public void onlyReflog() throws IOException {
                PersonIdent who = new PersonIdent("Log", "Ger", 1500079709, -8 * 60);