diff options
author | Ivan Frade <ifrade@google.com> | 2023-05-08 15:00:46 -0400 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2023-05-08 15:00:46 -0400 |
commit | 73f9f55e3b87a8fa9f9f5d40b6ace6a09fbbc16b (patch) | |
tree | fb9782f366412586d9db34c51f09b550d92f655e /org.eclipse.jgit.test | |
parent | 74fa245b3c3ccf13afcbec7911c7c8459e48527d (diff) | |
parent | ce88e62edc4dfd6e07d43720c399ec169d594ad7 (diff) | |
download | jgit-73f9f55e3b87a8fa9f9f5d40b6ace6a09fbbc16b.tar.gz jgit-73f9f55e3b87a8fa9f9f5d40b6ace6a09fbbc16b.zip |
Merge "PackWriter: write the PackReverseIndex file"
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java index 2a403c7699..24a81b6715 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java @@ -542,6 +542,39 @@ public class PackWriterTest extends SampleDataRepositoryTestCase { } @Test + public void testWriteReverseIndexConfig() { + assertFalse(config.isWriteReverseIndex()); + config.setWriteReverseIndex(true); + assertTrue(config.isWriteReverseIndex()); + } + + @Test + public void testWriteReverseIndexOff() throws Exception { + config.setWriteReverseIndex(false); + writer = new PackWriter(config, db.newObjectReader()); + ByteArrayOutputStream reverseIndexOutput = new ByteArrayOutputStream(); + + writer.writeReverseIndex(reverseIndexOutput); + + assertEquals(0, reverseIndexOutput.size()); + } + + @Test + public void testWriteReverseIndexOn() throws Exception { + config.setWriteReverseIndex(true); + writeVerifyPack4(false); + ByteArrayOutputStream reverseIndexOutput = new ByteArrayOutputStream(); + int headerBytes = 12; + int bodyBytes = 12; + int footerBytes = 40; + + writer.writeReverseIndex(reverseIndexOutput); + + assertTrue(reverseIndexOutput.size() == headerBytes + bodyBytes + + footerBytes); + } + + @Test public void testExclude() throws Exception { // TestRepository closes repo FileRepository repo = createBareRepository(); |