|
|
|
@ -366,11 +366,10 @@ public class ObjectDirectoryPackParser extends PackParser {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void onEndThinPack() throws IOException { |
|
|
|
|
final byte[] tailHash = this.tailDigest.digest(); |
|
|
|
|
final byte[] buf = buffer(); |
|
|
|
|
|
|
|
|
|
final MessageDigest origDigest = Constants.newMessageDigest(); |
|
|
|
|
final MessageDigest tailDigest = Constants.newMessageDigest(); |
|
|
|
|
final MessageDigest tailDigest2 = Constants.newMessageDigest(); |
|
|
|
|
final MessageDigest packDigest = Constants.newMessageDigest(); |
|
|
|
|
|
|
|
|
|
long origRemaining = origEnd; |
|
|
|
@ -393,15 +392,15 @@ public class ObjectDirectoryPackParser extends PackParser {
|
|
|
|
|
origDigest.update(buf, 0, origCnt); |
|
|
|
|
origRemaining -= origCnt; |
|
|
|
|
if (origRemaining == 0) |
|
|
|
|
tailDigest.update(buf, origCnt, n - origCnt); |
|
|
|
|
tailDigest2.update(buf, origCnt, n - origCnt); |
|
|
|
|
} else |
|
|
|
|
tailDigest.update(buf, 0, n); |
|
|
|
|
tailDigest2.update(buf, 0, n); |
|
|
|
|
|
|
|
|
|
packDigest.update(buf, 0, n); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!Arrays.equals(origDigest.digest(), origHash) |
|
|
|
|
|| !Arrays.equals(tailDigest.digest(), tailHash)) |
|
|
|
|
if (!Arrays.equals(origDigest.digest(), origHash) || !Arrays |
|
|
|
|
.equals(tailDigest2.digest(), this.tailDigest.digest())) |
|
|
|
|
throw new IOException( |
|
|
|
|
JGitText.get().packCorruptedWhileWritingToFilesystem); |
|
|
|
|
|
|
|
|
|