{"thread":{"id":"18554","subject":"[JGIT PATCH 1/5] Remove dead/unused reset method from CountingOutputStream","startedAt":"2009-03-26T01:21:51Z","lastAt":"2009-03-27T23:53:24Z","messageCount":11,"participants":["Shawn O. Pearce","Daniel Cheng","Robin Rosenberg"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"109450","messageId":"1238030515-31768-1-git-send-email-spearce@spearce.org","threadId":"18554","inReplyTo":null,"subject":"[JGIT PATCH 1/5] Remove dead/unused reset method from CountingOutputStream","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-26T01:21:51Z","receivedAt":"2009-03-26T01:21:51Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"We never reset the stream, so just remove that as a valid option.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../spearce/jgit/util/CountingOutputStream.java    |   10 +---------\n 1 files changed, 1 insertions(+), 9 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/util/CountingOutputStream.java b/org.spearce.jgit/src/org/spearce/jgit/util/CountingOutputStream.java\nindex b0b5f7d..5f333f5 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/util/CountingOutputStream.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/util/CountingOutputStream.java\n@@ -72,17 +72,9 @@ public void write(byte[] b, int off, int len) throws IOException {\n \t/**\n \t * Return number of already written bytes.\n \t *\n-\t * @return number of written bytes since last reset (object is reset upon\n-\t *         creation)\n+\t * @return number of written bytes since stream start.\n \t */\n \tpublic long getCount() {\n \t\treturn count;\n \t}\n-\n-\t/**\n-\t * Reset counter to zero value.\n-\t */\n-\tpublic void reset() {\n-\t\tcount = 0;\n-\t}\n }\n-- \n1.6.2.1.471.g682837\n"},{"id":"109451","messageId":"1238030515-31768-2-git-send-email-spearce@spearce.org","threadId":"18554","inReplyTo":"1238030515-31768-1-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 2/5] Implement CRC32 computation during PackWriter","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-26T01:21:52Z","receivedAt":"2009-03-26T01:21:52Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"To correctly create a v2 index file for a pack we must compute the\nCRC32 code for each object entry as they are written out, otherwise\nthe CRC32 table will be full of 0's, and fail verification if the\nresulting pack were to be reused.\n\nReported-by: Daniel Cheng (aka SDiZ) <j16sdiz+freenet@gmail.com>\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../tst/org/spearce/jgit/lib/PackWriterTest.java   |   17 +++---\n .../PackOutputStream.java}                         |   65 +++++++++++++-------\n .../src/org/spearce/jgit/lib/PackWriter.java       |   16 ++---\n 3 files changed, 57 insertions(+), 41 deletions(-)\n rename org.spearce.jgit/src/org/spearce/jgit/{util/CountingOutputStream.java => lib/PackOutputStream.java} (61%)\n\ndiff --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\nindex f7139fc..46616e3 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java\n@@ -56,7 +56,6 @@\n import org.spearce.jgit.revwalk.RevObject;\n import org.spearce.jgit.revwalk.RevWalk;\n import org.spearce.jgit.transport.IndexPack;\n-import org.spearce.jgit.util.CountingOutputStream;\n import org.spearce.jgit.util.JGitTestUtil;\n \n public class PackWriterTest extends RepositoryTestCase {\n@@ -71,7 +70,7 @@\n \n \tprivate ByteArrayOutputStream os;\n \n-\tprivate CountingOutputStream cos;\n+\tprivate PackOutputStream cos;\n \n \tprivate File packBase;\n \n@@ -84,7 +83,7 @@\n \tpublic void setUp() throws Exception {\n \t\tsuper.setUp();\n \t\tos = new ByteArrayOutputStream();\n-\t\tcos = new CountingOutputStream(os);\n+\t\tcos = new PackOutputStream(os);\n \t\tpackBase = new File(trash, \"tmp_pack\");\n \t\tpackFile = new File(trash, \"tmp_pack.pack\");\n \t\tindexFile = new File(trash, \"tmp_pack.idx\");\n@@ -308,11 +307,11 @@ public void testWritePack4ThinPack() throws IOException {\n \t */\n \tpublic void testWritePack2SizeDeltasVsNoDeltas() throws Exception {\n \t\ttestWritePack2();\n-\t\tfinal long sizePack2NoDeltas = cos.getCount();\n+\t\tfinal long sizePack2NoDeltas = cos.length();\n \t\ttearDown();\n \t\tsetUp();\n \t\ttestWritePack2DeltasReuseRefs();\n-\t\tfinal long sizePack2DeltasRefs = cos.getCount();\n+\t\tfinal long sizePack2DeltasRefs = cos.length();\n \n \t\tassertTrue(sizePack2NoDeltas > sizePack2DeltasRefs);\n \t}\n@@ -327,11 +326,11 @@ public void testWritePack2SizeDeltasVsNoDeltas() throws Exception {\n \t */\n \tpublic void testWritePack2SizeOffsetsVsRefs() throws Exception {\n \t\ttestWritePack2DeltasReuseRefs();\n-\t\tfinal long sizePack2DeltasRefs = cos.getCount();\n+\t\tfinal long sizePack2DeltasRefs = cos.length();\n \t\ttearDown();\n \t\tsetUp();\n \t\ttestWritePack2DeltasReuseOffsets();\n-\t\tfinal long sizePack2DeltasOffsets = cos.getCount();\n+\t\tfinal long sizePack2DeltasOffsets = cos.length();\n \n \t\tassertTrue(sizePack2DeltasRefs > sizePack2DeltasOffsets);\n \t}\n@@ -345,11 +344,11 @@ public void testWritePack2SizeOffsetsVsRefs() throws Exception {\n \t */\n \tpublic void testWritePack4SizeThinVsNoThin() throws Exception {\n \t\ttestWritePack4();\n-\t\tfinal long sizePack4 = cos.getCount();\n+\t\tfinal long sizePack4 = cos.length();\n \t\ttearDown();\n \t\tsetUp();\n \t\ttestWritePack4ThinPack();\n-\t\tfinal long sizePack4Thin = cos.getCount();\n+\t\tfinal long sizePack4Thin = cos.length();\n \n \t\tassertTrue(sizePack4 > sizePack4Thin);\n \t}\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/util/CountingOutputStream.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PackOutputStream.java\nsimilarity index 61%\nrename from org.spearce.jgit/src/org/spearce/jgit/util/CountingOutputStream.java\nrename to org.spearce.jgit/src/org/spearce/jgit/lib/PackOutputStream.java\nindex 5f333f5..403b892 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/util/CountingOutputStream.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackOutputStream.java\n@@ -1,4 +1,5 @@\n /*\n+ * Copyright (C) 2009, Google Inc.\n  * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>\n  *\n  * All rights reserved.\n@@ -35,46 +36,66 @@\n  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n  */\n \n-package org.spearce.jgit.util;\n+package org.spearce.jgit.lib;\n \n-import java.io.FilterOutputStream;\n import java.io.IOException;\n import java.io.OutputStream;\n+import java.security.MessageDigest;\n+import java.util.zip.CRC32;\n+\n+/** Custom output stream to support {@link PackWriter}. */\n+final class PackOutputStream extends OutputStream {\n+\tprivate final OutputStream out;\n+\n+\tprivate final CRC32 crc = new CRC32();\n+\n+\tprivate final MessageDigest md = Constants.newMessageDigest();\n \n-/**\n- * Counting output stream decoration. Counts bytes written to stream.\n- */\n-public class CountingOutputStream extends FilterOutputStream {\n \tprivate long count;\n \n-\t/**\n-\t * Create counting stream being decorated to provided real output stream.\n-\t *\n-\t * @param out\n-\t *            output stream where data should be written\n-\t */\n-\tpublic CountingOutputStream(OutputStream out) {\n-\t\tsuper(out);\n+\tPackOutputStream(final OutputStream out) {\n+\t\tthis.out = out;\n \t}\n \n \t@Override\n-\tpublic void write(int b) throws IOException {\n+\tpublic void write(final int b) throws IOException {\n \t\tout.write(b);\n+\t\tcrc.update(b);\n+\t\tmd.update((byte) b);\n \t\tcount++;\n \t}\n \n \t@Override\n-\tpublic void write(byte[] b, int off, int len) throws IOException {\n+\tpublic void write(final byte[] b, final int off, final int len)\n+\t\t\tthrows IOException {\n \t\tout.write(b, off, len);\n+\t\tcrc.update(b, off, len);\n+\t\tmd.update(b, off, len);\n \t\tcount += len;\n \t}\n \n-\t/**\n-\t * Return number of already written bytes.\n-\t *\n-\t * @return number of written bytes since stream start.\n-\t */\n-\tpublic long getCount() {\n+\t@Override\n+\tpublic void flush() throws IOException {\n+\t\tout.flush();\n+\t}\n+\n+\t/** @return total number of bytes written since stream start. */\n+\tlong length() {\n \t\treturn count;\n \t}\n+\n+\t/** @return obtain the current CRC32 register. */\n+\tint getCRC32() {\n+\t\treturn (int) crc.getValue();\n+\t}\n+\n+\t/** Reinitialize the CRC32 register for a new region. */\n+\tvoid resetCRC32() {\n+\t\tcrc.reset();\n+\t}\n+\n+\t/** @return obtain the current SHA-1 digest. */\n+\tbyte[] getDigest() {\n+\t\treturn md.digest();\n+\t}\n }\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java\nindex 601ce71..cfec35c 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java\n@@ -40,7 +40,6 @@\n import java.io.BufferedOutputStream;\n import java.io.IOException;\n import java.io.OutputStream;\n-import java.security.DigestOutputStream;\n import java.security.MessageDigest;\n import java.util.ArrayList;\n import java.util.Collection;\n@@ -57,7 +56,6 @@\n import org.spearce.jgit.revwalk.RevObject;\n import org.spearce.jgit.revwalk.RevSort;\n import org.spearce.jgit.transport.PackedObjectInfo;\n-import org.spearce.jgit.util.CountingOutputStream;\n import org.spearce.jgit.util.NB;\n \n /**\n@@ -166,9 +164,7 @@\n \n \tprivate final Repository db;\n \n-\tprivate DigestOutputStream out;\n-\n-\tprivate CountingOutputStream countingOut;\n+\tprivate PackOutputStream out;\n \n \tprivate final Deflater deflater;\n \n@@ -563,8 +559,7 @@ public void writePack(OutputStream packStream) throws IOException {\n \n \t\tif (!(packStream instanceof BufferedOutputStream))\n \t\t\tpackStream = new BufferedOutputStream(packStream);\n-\t\tcountingOut = new CountingOutputStream(packStream);\n-\t\tout = new DigestOutputStream(countingOut, Constants.newMessageDigest());\n+\t\tout = new PackOutputStream(packStream);\n \n \t\twriteMonitor.beginTask(WRITING_OBJECTS_PROGRESS, getObjectsNumber());\n \t\twriteHeader();\n@@ -687,11 +682,13 @@ private void writeObject(final ObjectToPack otp) throws IOException {\n \n \t\tassert !otp.isWritten();\n \n-\t\totp.setOffset(countingOut.getCount());\n+\t\tout.resetCRC32();\n+\t\totp.setOffset(out.length());\n \t\tif (otp.isDeltaRepresentation())\n \t\t\twriteDeltaObject(otp);\n \t\telse\n \t\t\twriteWholeObject(otp);\n+\t\totp.setCRC(out.getCRC32());\n \n \t\twriteMonitor.update(1);\n \t}\n@@ -753,8 +750,7 @@ private void writeObjectHeader(final int objectType, long dataLength)\n \t}\n \n \tprivate void writeChecksum() throws IOException {\n-\t\tout.on(false);\n-\t\tpackcsum = out.getMessageDigest().digest();\n+\t\tpackcsum = out.getDigest();\n \t\tout.write(packcsum);\n \t}\n \n-- \n1.6.2.1.471.g682837\n"},{"id":"109453","messageId":"1238030515-31768-3-git-send-email-spearce@spearce.org","threadId":"18554","inReplyTo":"1238030515-31768-2-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 3/5] Test case for pack index CRC32 when written by PackWriter","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-26T01:21:53Z","receivedAt":"2009-03-26T01:21:53Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Suggested-by: Daniel Cheng (aka SDiZ) <j16sdiz+freenet@gmail.com>\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../tst/org/spearce/jgit/lib/PackWriterTest.java   |   33 ++++++++++++++++++++\n 1 files changed, 33 insertions(+), 0 deletions(-)\n\ndiff --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\nindex 46616e3..636059f 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java\n@@ -40,6 +40,7 @@\n import java.io.ByteArrayInputStream;\n import java.io.ByteArrayOutputStream;\n import java.io.File;\n+import java.io.FileOutputStream;\n import java.io.IOException;\n import java.io.InputStream;\n import java.util.ArrayList;\n@@ -353,6 +354,37 @@ public void testWritePack4SizeThinVsNoThin() throws Exception {\n \t\tassertTrue(sizePack4 > sizePack4Thin);\n \t}\n \n+\tpublic void testWriteIndex() throws Exception {\n+\t\twriter.setIndexVersion(2);\n+\t\twriteVerifyPack4(false);\n+\n+\t\t// Validate that IndexPack came up with the right CRC32 value.\n+\t\tfinal PackIndex idx1 = PackIndex.open(indexFile);\n+\t\tassertTrue(idx1 instanceof PackIndexV2);\n+\t\tassertEquals(0x4743F1E4L, idx1.findCRC32(ObjectId\n+\t\t\t\t.fromString(\"82c6b885ff600be425b4ea96dee75dca255b69e7\")));\n+\n+\t\t// Validate that an index written by PackWriter is the same.\n+\t\tfinal File idx2File = new File(indexFile.getAbsolutePath() + \".2\");\n+\t\tfinal FileOutputStream is = new FileOutputStream(idx2File);\n+\t\ttry {\n+\t\t\twriter.writeIndex(is);\n+\t\t} finally {\n+\t\t\tis.close();\n+\t\t}\n+\t\tfinal PackIndex idx2 = PackIndex.open(idx2File);\n+\t\tassertTrue(idx2 instanceof PackIndexV2);\n+\t\tassertEquals(idx1.getObjectCount(), idx2.getObjectCount());\n+\t\tassertEquals(idx1.getOffset64Count(), idx2.getOffset64Count());\n+\n+\t\tfor (int i = 0; i < idx1.getObjectCount(); i++) {\n+\t\t\tfinal ObjectId id = idx1.getObjectId(i);\n+\t\t\tassertEquals(id, idx2.getObjectId(i));\n+\t\t\tassertEquals(idx1.findOffset(id), idx2.findOffset(id));\n+\t\t\tassertEquals(idx1.findCRC32(id), idx2.findCRC32(id));\n+\t\t}\n+\t}\n+\n \t// TODO: testWritePackDeltasCycle()\n \t// TODO: testWritePackDeltasDepth()\n \n@@ -469,6 +501,7 @@ private void verifyOpenPack(final boolean thin) throws IOException {\n \t\tfinal IndexPack indexer = new IndexPack(db, is, packBase);\n \t\tindexer.setKeepEmpty(true);\n \t\tindexer.setFixThin(thin);\n+\t\tindexer.setIndexVersion(2);\n \t\tindexer.index(new TextProgressMonitor());\n \t\tpack = new PackFile(indexFile, packFile);\n \t}\n-- \n1.6.2.1.471.g682837\n"},{"id":"109452","messageId":"1238030515-31768-4-git-send-email-spearce@spearce.org","threadId":"18554","inReplyTo":"1238030515-31768-3-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 4/5] Write the pack header in one shot","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-26T01:21:54Z","receivedAt":"2009-03-26T01:21:54Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Instead of making 3 individual write calls of 4 bytes each, write\nthe entire header as a single 12 byte buffer.  Its also a little\nbit easier to follow the final code, that these items appear at\nthe 0/4/8 offsets within the 12 byte long header.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../src/org/spearce/jgit/lib/PackWriter.java       |   11 ++++-------\n 1 files changed, 4 insertions(+), 7 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java\nindex cfec35c..2f34255 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java\n@@ -644,13 +644,10 @@ private void selectObjectReuseForObject(final ObjectToPack otp,\n \t}\n \n \tprivate void writeHeader() throws IOException {\n-\t\tout.write(Constants.PACK_SIGNATURE);\n-\n-\t\tNB.encodeInt32(buf, 0, PACK_VERSION_GENERATED);\n-\t\tout.write(buf, 0, 4);\n-\n-\t\tNB.encodeInt32(buf, 0, getObjectsNumber());\n-\t\tout.write(buf, 0, 4);\n+\t\tSystem.arraycopy(Constants.PACK_SIGNATURE, 0, buf, 0, 4);\n+\t\tNB.encodeInt32(buf, 4, PACK_VERSION_GENERATED);\n+\t\tNB.encodeInt32(buf, 8, getObjectsNumber());\n+\t\tout.write(buf, 0, 12);\n \t}\n \n \tprivate void writeObjects() throws IOException {\n-- \n1.6.2.1.471.g682837\n"},{"id":"109454","messageId":"1238030515-31768-5-git-send-email-spearce@spearce.org","threadId":"18554","inReplyTo":"1238030515-31768-4-git-send-email-spearce@spearce.org","subject":"[JGIT PATCH 5/5] Use Deflater directly in PackWriter","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-26T01:21:55Z","receivedAt":"2009-03-26T01:21:55Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Rather than going through all of the indirection that makes up the\nDeflaterOutputStream, including the new object construction for it\nand the temporary buffer it allocates internally, we can pump data\ndirectly through our Deflater instance and use our existing 16 KB\ntemporary \"buf\" for the transient storage as we compress data to\nthe pack output stream.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n .../src/org/spearce/jgit/lib/PackWriter.java       |   12 +++++++-----\n 1 files changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java\nindex 2f34255..2d05c4e 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java\n@@ -47,7 +47,6 @@\n import java.util.Iterator;\n import java.util.List;\n import java.util.zip.Deflater;\n-import java.util.zip.DeflaterOutputStream;\n \n import org.spearce.jgit.errors.IncorrectObjectTypeException;\n import org.spearce.jgit.errors.MissingObjectException;\n@@ -699,12 +698,15 @@ private void writeWholeObject(final ObjectToPack otp) throws IOException {\n \t\t} else {\n \t\t\tfinal ObjectLoader loader = db.openObject(windowCursor, otp);\n \t\t\tfinal byte[] data = loader.getCachedBytes();\n-\t\t\tfinal DeflaterOutputStream deflaterOut = new DeflaterOutputStream(\n-\t\t\t\t\tout, deflater);\n \t\t\twriteObjectHeader(otp.getType(), data.length);\n-\t\t\tdeflaterOut.write(data);\n-\t\t\tdeflaterOut.finish();\n \t\t\tdeflater.reset();\n+\t\t\tdeflater.setInput(data, 0, data.length);\n+\t\t\tdeflater.finish();\n+\t\t\tdo {\n+\t\t\t\tfinal int n = deflater.deflate(buf, 0, buf.length);\n+\t\t\t\tif (n > 0)\n+\t\t\t\t\tout.write(buf, 0, n);\n+\t\t\t} while (!deflater.finished());\n \t\t}\n \t}\n \n-- \n1.6.2.1.471.g682837\n"},{"id":"109545","messageId":"49CBA0A5.6090804@gmail.com","threadId":"18554","inReplyTo":"1238030515-31768-3-git-send-email-spearce@spearce.org","subject":"Re: [JGIT PATCH 3/5] Test case for pack index CRC32 when written by PackWriter","fromName":"Daniel Cheng","fromEmail":"j16sdiz+freenet@gmail.com","sentAt":"2009-03-26T15:35:01Z","receivedAt":"2009-03-26T15:35:01Z","isPatch":true,"sender":{"key":"j16sdiz+freenet@gmail.com","avatar":"https://gravatar.com/avatar/3e796e8a156ee86e305bfc1fbe01608302554ee3b5fa7eb8d1213b8877bfcabd?d=mp&s=160"},"body":"Shawn O. Pearce wrote:\n> Suggested-by: Daniel Cheng (aka SDiZ) <j16sdiz+freenet@gmail.com>\n> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>\n> ---\n>  .../tst/org/spearce/jgit/lib/PackWriterTest.java   |   33 ++++++++++++++++++++\n>  1 files changed, 33 insertions(+), 0 deletions(-)\n> \n\nThanks.\n\n\n-- \n"},{"id":"109543","messageId":"49CBA0B8.7070908@gmail.com","threadId":"18554","inReplyTo":"1238030515-31768-3-git-send-email-spearce@spearce.org","subject":"Re: [JGIT PATCH 3/5] Test case for pack index CRC32 when written by PackWriter","fromName":"Daniel Cheng","fromEmail":"j16sdiz+freenet@gmail.com","sentAt":"2009-03-26T15:35:20Z","receivedAt":"2009-03-26T15:35:20Z","isPatch":true,"sender":{"key":"j16sdiz+freenet@gmail.com","avatar":"https://gravatar.com/avatar/3e796e8a156ee86e305bfc1fbe01608302554ee3b5fa7eb8d1213b8877bfcabd?d=mp&s=160"},"body":"Shawn O. Pearce wrote:\n> Suggested-by: Daniel Cheng (aka SDiZ) <j16sdiz+freenet@gmail.com>\n> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>\n> ---\n>  .../tst/org/spearce/jgit/lib/PackWriterTest.java   |   33 ++++++++++++++++++++\n>  1 files changed, 33 insertions(+), 0 deletions(-)\n> \n\nThanks.\n"},{"id":"109623","messageId":"200903270911.54571.robin.rosenberg.lists@dewire.com","threadId":"18554","inReplyTo":"1238030515-31768-1-git-send-email-spearce@spearce.org","subject":"Re: patch series starting with [JGIT PATCH 1/5] Remove dead/unused reset method from CountingOutputStream","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2009-03-27T08:11:54Z","receivedAt":"2009-03-27T08:11:54Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"\nSeems fine. While verifying this I got this error.\n\njgit push sftp://me@calhost/home/me/tmp/cb/.git master:master\n\nCounting objects:       20464\nCompressing objects:    100% (20464/20464)\nWriting objects:        100% (20464/20464)\nfatal: Can't write /home/me/tmp/cb/.git/objects/../HEAD: Failure\nfatal: sftp://me@localhost/home/me/tmp/cb/.git: cannot create HEAD\n\nIt seems the remote repo is OK and actually has handsome HEAD despite this.\n\nMore related, I also noted that the git:// ssh or file: clone calculates the CRC's separately\nand wasn't subject to this bug.\n\n-- robin\n"},{"id":"109653","messageId":"20090327145100.GM23521@spearce.org","threadId":"18554","inReplyTo":"200903270911.54571.robin.rosenberg.lists@dewire.com","subject":"Re: patch series starting with [JGIT PATCH 1/5] Remove dead/unused reset method from CountingOutputStream","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-27T14:51:00Z","receivedAt":"2009-03-27T14:51:00Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:\n> \n> More related, I also noted that the git:// ssh or file: clone calculates the CRC's separately\n> and wasn't subject to this bug.\n\nclone (or fetch) is going through IndexPack, which has its own logic\nto tear apart a pack file and build up the table of contents of\nthat pack in the most efficient method possible.  Its an entirely\ndifferent code base than writing a pack, because its going the\nother direction.  :-)\n\nThe new test case at least validates that both IndexPack and\nPackWriter produce the same information in the .idx file.\n\n-- \nShawn.\n"},{"id":"109654","messageId":"20090327145550.GN23521@spearce.org","threadId":"18554","inReplyTo":"200903270911.54571.robin.rosenberg.lists@dewire.com","subject":"Re: patch series starting with [JGIT PATCH 1/5] Remove dead/unused reset method from CountingOutputStream","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-27T14:55:50Z","receivedAt":"2009-03-27T14:55:50Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:\n> Seems fine. While verifying this I got this error.\n> \n> jgit push sftp://me@calhost/home/me/tmp/cb/.git master:master\n> \n> Counting objects:       20464\n> Compressing objects:    100% (20464/20464)\n> Writing objects:        100% (20464/20464)\n> fatal: Can't write /home/me/tmp/cb/.git/objects/../HEAD: Failure\n> fatal: sftp://me@localhost/home/me/tmp/cb/.git: cannot create HEAD\n\nI can't reproduce this error with sftp://.\n\nAt first, it failed to push because my target directory didn't exist.\n\nAfter I made the target directory, I also had to create below it\n\"refs\", \"objects\", \"objects/pack\" in order to get the push to\nsucceed, and then it went through clean.\n \n-- \nShawn.\n"},{"id":"109679","messageId":"200903280053.25070.robin.rosenberg.lists@dewire.com","threadId":"18554","inReplyTo":"20090327145550.GN23521@spearce.org","subject":"Re: patch series starting with [JGIT PATCH 1/5] Remove dead/unused reset method from CountingOutputStream","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2009-03-27T23:53:24Z","receivedAt":"2009-03-27T23:53:24Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"fredag 27 mars 2009 15:55:50 skrev \"Shawn O. Pearce\" <spearce@spearce.org>:\n> Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:\n> > Seems fine. While verifying this I got this error.\n> > \n> > jgit push sftp://me@calhost/home/me/tmp/cb/.git master:master\n> > \n> > Counting objects:       20464\n> > Compressing objects:    100% (20464/20464)\n> > Writing objects:        100% (20464/20464)\n> > fatal: Can't write /home/me/tmp/cb/.git/objects/../HEAD: Failure\n> > fatal: sftp://me@localhost/home/me/tmp/cb/.git: cannot create HEAD\n> \n> I can't reproduce this error with sftp://.\n> \n> At first, it failed to push because my target directory didn't exist.\nSame here.\n\n> After I made the target directory, I also had to create below it\n> \"refs\", \"objects\", \"objects/pack\" in order to get the push to\n> succeed, and then it went through clean.\n\nhm, I git init'd the repo on the server, that's cheating I suppose.\n\n-- robin\n"}]}