Refactor object database access with new abstraction
commit86c09db9ecc5876524e0ae7a0aee15bb7df4a48c
authorShawn O. Pearce <spearce@spearce.org>
Tue, 21 Apr 2009 01:21:08 +0000 (20 18:21 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Thu, 23 Apr 2009 22:25:57 +0000 (24 00:25 +0200)
tree1a3a6e4d7492f13bf07536fa22e808023bf4255c
parent3da8761ffdb95a8aa2707dd5fe0b58b56bc39cda
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>
org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0004_PackReader.java
org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDatabase.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
org.spearce.jgit/src/org/spearce/jgit/lib/UnpackedObjectLoader.java