pack: use a cache for delta bases when unpacking

Bring back the use of the delta base cache for unpacking objects. When
generating the delta chain, we stop when we find a delta base in the
pack's cache and use that as the starting point.
pack: make sure not to leak the dep chain
pack: preallocate a 64-element chain

Dependency chains are often large and require a few
reallocations. Allocate a 64-element chain before doing anything else to
avoid allocations during the loop.

This value comes from the stack-allocated one git uses. We still
allocate this on the heap, but it does help performance a little bit.