public Ref peel(final Ref ref) throws IOException {
final Ref leaf = ref.getLeaf();
if (leaf.isPeeled() || leaf.getObjectId() == null)
return ref;
ObjectIdRef newLeaf = doPeel(leaf);
// Try to remember this peeling in the cache, so we don't have to do
// it again in the future, but only if the reference is unchanged.
if (leaf.getStorage().isLoose()) {
RefList<LooseRef> curList = looseRefs.get();