|
|
|
@ -222,20 +222,21 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs {
|
|
|
|
|
ObjectLoader ldr; |
|
|
|
|
if (last != null) { |
|
|
|
|
ldr = last.get(this, objectId); |
|
|
|
|
if (ldr != null) |
|
|
|
|
return ldr; |
|
|
|
|
if (ldr != null) { |
|
|
|
|
return checkType(ldr, objectId, typeHint); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
PackList packList = db.getPackList(); |
|
|
|
|
boolean noGarbage = avoidUnreachable; |
|
|
|
|
ldr = openImpl(packList, objectId, noGarbage); |
|
|
|
|
if (ldr != null) { |
|
|
|
|
return ldr; |
|
|
|
|
return checkType(ldr, objectId, typeHint); |
|
|
|
|
} |
|
|
|
|
if (packList.dirty()) { |
|
|
|
|
ldr = openImpl(db.scanPacks(packList), objectId, noGarbage); |
|
|
|
|
if (ldr != null) { |
|
|
|
|
return ldr; |
|
|
|
|
return checkType(ldr, objectId, typeHint); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -245,6 +246,14 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs {
|
|
|
|
|
throw new MissingObjectException(objectId.copy(), typeHint); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static ObjectLoader checkType(ObjectLoader ldr, AnyObjectId id, |
|
|
|
|
int typeHint) throws IncorrectObjectTypeException { |
|
|
|
|
if (typeHint != OBJ_ANY && ldr.getType() != typeHint) { |
|
|
|
|
throw new IncorrectObjectTypeException(id.copy(), typeHint); |
|
|
|
|
} |
|
|
|
|
return ldr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private ObjectLoader openImpl(PackList packList, AnyObjectId objectId, |
|
|
|
|
boolean noGarbage) throws IOException { |
|
|
|
|
for (DfsPackFile pack : packList.packs) { |
|
|
|
|