git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH JGIT 2/2] Test case for pack index CRC

From
Daniel Cheng (aka SDiZ) <j16sdiz+freenet@gmail.com>
Date
Mar 25, 2009, 06:21 UTC
Message-ID
<1237962115-22709-2-git-send-email-j16sdiz+freenet@gmail.com>
In-Reply-To
<1237962115-22709-1-git-send-email-j16sdiz+freenet@gmail.com>
Signed-off-by: Daniel Cheng (aka SDiZ) <j16sdiz+freenet@gmail.com>
---
 .../tst/org/spearce/jgit/lib/PackWriterTest.java   |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java
index f7139fc..9a5513f 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java
@@ -354,6 +354,15 @@ public class PackWriterTest extends RepositoryTestCase {
 		assertTrue(sizePack4 > sizePack4Thin);
 	}
 
+	public void testWriteIndex() throws Exception {
+		writer.setIndexVersion(2);
+		writeVerifyPack4(true);
+		
+		PackIndex idx = PackIndex.open(indexFile);
+		assertEquals(0x4743F1E4L, idx.findCRC32(ObjectId
+				.fromString("82c6b885ff600be425b4ea96dee75dca255b69e7")));
+	}
+
 	// TODO: testWritePackDeltasCycle()
 	// TODO: testWritePackDeltasDepth()
 
@@ -470,6 +479,7 @@ public class PackWriterTest extends RepositoryTestCase {
 		final IndexPack indexer = new IndexPack(db, is, packBase);
 		indexer.setKeepEmpty(true);
 		indexer.setFixThin(thin);
+		indexer.setIndexVersion(2);
 		indexer.index(new TextProgressMonitor());
 		pack = new PackFile(indexFile, packFile);
 	}
-- 
1.6.2
Previous: Daniel Cheng (aka SDiZ)Next: Marek Zawirski
Message 4 of 7 in “[JGit] Mismatch CRC in packed objects from `jgit push`”
  1. Daniel ChengMar 24, 2009
  2. [JGIT Test Case] This (incomplete) test case demo the index wrong CRC bug.Daniel Cheng (aka SDiZ), Mar 24, 2009
  3. 1/2 Calculate CRC32 on Pack Index v2Daniel Cheng (aka SDiZ), Mar 25, 2009
  4. 2/2 Test case for pack index CRCDaniel Cheng (aka SDiZ), Mar 25, 2009
  5. Marek ZawirskiMar 25, 2009
  6. Shawn O. PearceMar 25, 2009
  7. Daniel ChengMar 26, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.