From 7a9edb3662a4345573752b5a77710b6d2b28e7fa Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 25 Aug 2010 16:46:43 -0700 Subject: [PATCH] Fix reuse from pack file for REF_DELTA types We miscomputed the CRC32 checksum for a REF_DELTA type of object, by not including the full 20 byte ObjectId of the delta base in the CRC code we use when the delta is too large to go through our two faster small reuse code paths. This resulted in a corruption error during packing, where the PackFile erroneously suspected the data was wrong on the local filesystem and aborted writing, because the CRC didn't match what we had read from the index. Change-Id: I7d12cdaeaf2c83ddc11223ce0108d9bd6886e025 Signed-off-by: Shawn O. Pearce --- .../src/org/eclipse/jgit/storage/file/PackFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java index 99637ee61..ed159ef38 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java @@ -334,7 +334,7 @@ private void copyAsIs2(PackOutputStream out, LocalObjectToPack src, readFully(src.offset + headerCnt, buf, 0, 20, curs); crc1.update(buf, 0, 20); - crc2.update(buf, 0, headerCnt); + crc2.update(buf, 0, 20); headerCnt += 20; } else { crc1.update(buf, 0, headerCnt);