Refactor object database access with new abstraction
By moving object database access out of the Repository class we
start to open the door for less-traditional databases, such as
storing objects in a distributed hash table or in-memory.
This change doesn't introduce any new functionality, nor does it
fix any existing bugs. A Repository instance still assumes that
its object database is in "$GIT_DIR/objects", and there is no way
to override that assumption.
Unlike the prior implementation, alternates are maintained as
discrete instances, rather than being inlined into the same list
as the repository's own object directory. This cleans up that
search logic as its now more clear when we scan the alternate
and when we scan the local repository. It also opens the door
for sharing shared repositories, e.g. if an IDE were to open
two repositories both forked from the same reference location
we could reuse the same ObjectDatabase instance between them.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>