From: "Daniel Cheng (aka SDiZ)" <j16sdiz+freenet@gmail.com>
To: git@vger.kernel.org
Cc: "Daniel Cheng (aka SDiZ)" <j16sdiz+freenet@gmail.com>
Subject: [JGIT Test Case] This (incomplete) test case demo the index wrong CRC bug.
Date: Tue, 24 Mar 2009 19:13:30 +0800 [thread overview]
Message-ID: <1237893210-23073-1-git-send-email-j16sdiz+freenet@gmail.com> (raw)
In-Reply-To: <ff6a9c820903231953q29a5ccbk8e5b54c9afdb8abd@mail.gmail.com>
The PackIndex always give 0 for CRC.
I know this patch is ugly, but I am not familiar with the code to make a good test code.
Signed-off-by: Daniel Cheng (aka SDiZ) <j16sdiz+freenet@gmail.com>
---
.../tst/org/spearce/jgit/lib/PackWriterTest.java | 14 ++++++++++++++
1 files changed, 14 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..0279c6b 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
@@ -40,6 +40,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -354,6 +355,19 @@ public void testWritePack4SizeThinVsNoThin() throws Exception {
assertTrue(sizePack4 > sizePack4Thin);
}
+ public void testWriteIndex() throws Exception {
+ testWritePack4();
+
+ File idxFile = File.createTempFile("temp", ".idx");
+ FileOutputStream ios = new FileOutputStream(idxFile);
+ writer.writeIndex(ios);
+ ios.close();
+
+ PackIndex idx = PackIndex.open(idxFile);
+ assertFalse(0 == idx.findCRC32(ObjectId
+ .fromString("82c6b885ff600be425b4ea96dee75dca255b69e7")));
+ }
+
// TODO: testWritePackDeltasCycle()
// TODO: testWritePackDeltasDepth()
--
1.6.2
next prev parent reply other threads:[~2009-03-24 11:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-24 2:53 [JGit] Mismatch CRC in packed objects from `jgit push` Daniel Cheng
2009-03-24 11:13 ` Daniel Cheng (aka SDiZ) [this message]
2009-03-25 6:21 ` [PATCH JGIT 1/2] Calculate CRC32 on Pack Index v2 Daniel Cheng (aka SDiZ)
2009-03-25 6:21 ` [PATCH JGIT 2/2] Test case for pack index CRC Daniel Cheng (aka SDiZ)
2009-03-25 13:31 ` [PATCH JGIT 1/2] Calculate CRC32 on Pack Index v2 Marek Zawirski
2009-03-25 21:59 ` Shawn O. Pearce
2009-03-26 0:49 ` Daniel Cheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1237893210-23073-1-git-send-email-j16sdiz+freenet@gmail.com \
--to=j16sdiz+freenet@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).