diff options
author | Han-Wen Nienhuys <hanwen@google.com> | 2019-07-30 19:26:34 +0200 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@google.com> | 2019-08-19 11:40:28 +0200 |
commit | 81801d6f965bacaed6c044ed26b5119043eb2133 (patch) | |
tree | 64a774372eeacdcd373d23e541996e5caec93c19 | |
parent | 9f9163cbcace9729eec181c0b2f1313a12fcb0b4 (diff) | |
download | jgit-81801d6f965bacaed6c044ed26b5119043eb2133.tar.gz jgit-81801d6f965bacaed6c044ed26b5119043eb2133.zip |
reftable: test absense of prefix matching in Reflog
Change-Id: I6705e6c57a8c080b17c7b93fdd598cf44a9d91c2
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java | 23 |
1 files changed, 23 insertions, 0 deletions
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 fc363ecf2f..b67ec563fd 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 @@ -568,6 +568,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); String msg = "test"; |