@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;
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);
adv.advertiseCapability(OPTION_ALLOW_TIP_SHA1_IN_WANT);
adv.advertiseCapability(OPTION_AGENT, UserAgent.get());
adv.setDerefTags(true);
- Map<String, Ref> refs = getAdvertisedOrDefaultRefs();
- findSymrefs(adv, refs);
- advertised = adv.send(refs);
+ Map<String, Ref> advertisedOrDefaultRefs = getAdvertisedOrDefaultRefs();
+ findSymrefs(adv, advertisedOrDefaultRefs);
+ advertised = adv.send(advertisedOrDefaultRefs);
if (adv.isEmpty())
adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); //$NON-NLS-1$
adv.end();
pckOut.end();
}
- private void findSymrefs(
+ private static void findSymrefs(
final RefAdvertiser adv, final Map<String, Ref> refs) {
Ref head = refs.get(Constants.HEAD);
if (head != null && head.isSymbolic()) {