|
|
@ -718,12 +718,11 @@ public class PackWriter { |
|
|
|
final PackedObjectLoader reuse = open(otp); |
|
|
|
final PackedObjectLoader reuse = open(otp); |
|
|
|
if (reuse != null) { |
|
|
|
if (reuse != null) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (otp.isDeltaRepresentation()) { |
|
|
|
if (otp.isDeltaRepresentation()) |
|
|
|
writeDeltaObjectReuse(otp, reuse); |
|
|
|
writeDeltaObjectHeader(otp, reuse); |
|
|
|
} else { |
|
|
|
else |
|
|
|
writeObjectHeader(otp.getType(), reuse.getSize()); |
|
|
|
writeObjectHeader(otp.getType(), reuse.getSize()); |
|
|
|
reuse.copyRawData(out, buf, windowCursor); |
|
|
|
reuse.copyRawData(out, buf, windowCursor); |
|
|
|
} |
|
|
|
|
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
reuse.endCopyRawData(); |
|
|
|
reuse.endCopyRawData(); |
|
|
|
} |
|
|
|
} |
|
|
@ -773,7 +772,7 @@ public class PackWriter { |
|
|
|
} while (!deflater.finished()); |
|
|
|
} while (!deflater.finished()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void writeDeltaObjectReuse(final ObjectToPack otp, |
|
|
|
private void writeDeltaObjectHeader(final ObjectToPack otp, |
|
|
|
final PackedObjectLoader reuse) throws IOException { |
|
|
|
final PackedObjectLoader reuse) throws IOException { |
|
|
|
if (deltaBaseAsOffset && otp.getDeltaBase() != null) { |
|
|
|
if (deltaBaseAsOffset && otp.getDeltaBase() != null) { |
|
|
|
writeObjectHeader(Constants.OBJ_OFS_DELTA, reuse.getRawSize()); |
|
|
|
writeObjectHeader(Constants.OBJ_OFS_DELTA, reuse.getRawSize()); |
|
|
@ -792,7 +791,6 @@ public class PackWriter { |
|
|
|
otp.getDeltaBaseId().copyRawTo(buf, 0); |
|
|
|
otp.getDeltaBaseId().copyRawTo(buf, 0); |
|
|
|
out.write(buf, 0, Constants.OBJECT_ID_LENGTH); |
|
|
|
out.write(buf, 0, Constants.OBJECT_ID_LENGTH); |
|
|
|
} |
|
|
|
} |
|
|
|
reuse.copyRawData(out, buf, windowCursor); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void writeObjectHeader(final int objectType, long dataLength) |
|
|
|
private void writeObjectHeader(final int objectType, long dataLength) |
|
|
|