//
final int infoLength = DirCacheEntry.getMaximumInfoLength(extended);
final byte[] infos = new byte[infoLength * entryCnt];
sortedEntries = new DirCacheEntry[entryCnt];
final MutableInteger infoAt = new MutableInteger();
for (int i = 0; i < entryCnt; i++)
sortedEntries[i] = new DirCacheEntry(infos, infoAt, in, md);
snapshot = FileSnapshot.save(liveFile);
// After the file entries are index extensions, and then a footer.
//
for (;;) {
in.mark(21);
IO.readFully(in, hdr, 0, 20);
if (in.read() < 0) {
// No extensions present; the file ended where we expected.
//
break;
}
in.reset();
md.update(hdr, 0, 8);
IO.skipFully(in, 8);
long sz = NB.decodeUInt32(hdr, 4);
switch (NB.decodeInt32(hdr, 0)) {
case EXT_TREE: {
if (Integer.MAX_VALUE < sz) {
throw new CorruptObjectException(MessageFormat.format(JGitText.get().DIRCExtensionIsTooLargeAt
, formatExtensionName(hdr), sz));
}
final byte[] raw = new byte[(int) sz];
IO.readFully(in, raw, 0, raw.length);
md.update(raw, 0, raw.length);
tree = new DirCacheTree(raw, new MutableInteger(), null);
break;
}
default:
if (hdr[0] >= 'A' && hdr[0] <= 'Z') {
// The extension is optional and is here only as