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 <spearce@spearce.org>
This commit is contained in:
parent
3a972f8664
commit
7a9edb3662
|
@ -334,7 +334,7 @@ private void copyAsIs2(PackOutputStream out, LocalObjectToPack src,
|
||||||
|
|
||||||
readFully(src.offset + headerCnt, buf, 0, 20, curs);
|
readFully(src.offset + headerCnt, buf, 0, 20, curs);
|
||||||
crc1.update(buf, 0, 20);
|
crc1.update(buf, 0, 20);
|
||||||
crc2.update(buf, 0, headerCnt);
|
crc2.update(buf, 0, 20);
|
||||||
headerCnt += 20;
|
headerCnt += 20;
|
||||||
} else {
|
} else {
|
||||||
crc1.update(buf, 0, headerCnt);
|
crc1.update(buf, 0, headerCnt);
|
||||||
|
|
Loading…
Reference in New Issue