summaryrefslogtreecommitdiff
path: root/lib/git/odb
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-06-04 00:09:00 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-06-04 00:09:00 +0200
commitb01ca6a3e4ae9d944d799743c8ff774e2a7a82b6 (patch)
treec9361bd06ccc563f61ff4d59647fe4f3d35e3528 /lib/git/odb
parent1906ee4df9ae4e734288c5203cf79894dff76cab (diff)
downloadgitpython-b01ca6a3e4ae9d944d799743c8ff774e2a7a82b6.tar.gz
db: implemented GitObjectDB using the git command to make sure we can lookup everything. Next is to implement pack-file reading, then alternates which should allow to resolve everything
Diffstat (limited to 'lib/git/odb')
-rw-r--r--lib/git/odb/db.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/git/odb/db.py b/lib/git/odb/db.py
index c970410d..1d1d4c40 100644
--- a/lib/git/odb/db.py
+++ b/lib/git/odb/db.py
@@ -281,9 +281,27 @@ class ReferenceDB(CompoundDB):
"""A database consisting of database referred to in a file"""
-class GitObjectDB(CompoundDB, iObjectDBW):
+#class GitObjectDB(CompoundDB, iObjectDBW):
+class GitObjectDB(LooseObjectDB):
"""A database representing the default git object store, which includes loose
objects, pack files and an alternates file
- It will create objects only in the loose object database."""
+ It will create objects only in the loose object database.
+ :note: for now, we use the git command to do all the lookup, just until he
+ have packs and the other implementations
+ """
+ __slots__ = ('_git', )
+ def __init__(self, root_path, git):
+ """Initialize this instance with the root and a git command"""
+ super(GitObjectDB, self).__init__(root_path)
+ self._git = git
+
+ def object_info(self, sha):
+ discard, type, size = self._git.get_object_header(sha)
+ return type, size
+
+ def object(self, sha):
+ """For now, all lookup is done by git itself"""
+ discard, type, size, stream = self._git.stream_object_data(sha)
+ return type, size, stream