summaryrefslogtreecommitdiff
path: root/lib/git/objects/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-14 23:37:45 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-14 23:37:45 +0200
commit2e6d110fbfa1f2e6a96bc8329e936d0cf1192844 (patch)
tree2b792542f3de64e63763444ae350d2410c3d00e8 /lib/git/objects/base.py
parent832b56394b079c9f6e4c777934447a9e224facfe (diff)
downloadgitpython-2e6d110fbfa1f2e6a96bc8329e936d0cf1192844.tar.gz
tree: now reads tress directly by parsing the binary data, allowing it to safe possibly hundreds of command calls
Diffstat (limited to 'lib/git/objects/base.py')
-rw-r--r--lib/git/objects/base.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/git/objects/base.py b/lib/git/objects/base.py
index 6752a25e..07538ada 100644
--- a/lib/git/objects/base.py
+++ b/lib/git/objects/base.py
@@ -6,7 +6,8 @@
import os
from git.utils import LazyMixin
-
+_assertion_msg_format = "Created object %r whose python type %r disagrees with the acutal git object type %r"
+
class Object(LazyMixin):
"""
Implements an Object which may be Blobs, Trees, Commits and Tags
@@ -49,10 +50,10 @@ class Object(LazyMixin):
"""
if attr == "size":
hexsha, typename, self.size = self.repo.git.get_object_header(self.id)
- assert typename == self.type, "Created object whose python type %r disagrees with the acutal git object type %r" % (typename, self.type)
+ assert typename == self.type, _assertion_msg_format % (self.id, typename, self.type)
elif attr == "data":
hexsha, typename, self.size, self.data = self.repo.git.get_object_data(self.id)
- assert typename == self.type, "Created object whose python type %r disagrees with the acutal git object type %r" % (typename, self.type)
+ assert typename == self.type, _assertion_msg_format % (self.id, typename, self.type)
else:
super(Object,self)._set_cache_(attr)