summaryrefslogtreecommitdiff
path: root/lib/git/objects/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-07-07 17:30:47 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-07-07 17:30:47 +0200
commitbc31651674648f026464fd4110858c4ffeac3c18 (patch)
treed52bd46d5a2c00c6c852148dba16a29d31ae3a5c /lib/git/objects/base.py
parentf068cdc5a1a13539c4a1d756ae950aab65f5348b (diff)
downloadgitpython-bc31651674648f026464fd4110858c4ffeac3c18.tar.gz
Adjusted previous object creators to use the rev_parse method directly. rev_parse could be adjusted not to return Objects anymore, providing better performance for those who just want a sha only. On the other hand, the method is high-level and should be convenient to use as well, its a starting point for more usually, hence its unlikely to call it in tight loops
Diffstat (limited to 'lib/git/objects/base.py')
-rw-r--r--lib/git/objects/base.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/git/objects/base.py b/lib/git/objects/base.py
index 21b9b1ea..41862ac2 100644
--- a/lib/git/objects/base.py
+++ b/lib/git/objects/base.py
@@ -49,10 +49,7 @@ class Object(LazyMixin):
:note: This cannot be a __new__ method as it would always call __init__
with the input id which is not necessarily a binsha."""
- hexsha, typename, size = repo.git.get_object_header(id)
- inst = get_object_type_by_name(typename)(repo, hex_to_bin(hexsha))
- inst.size = size
- return inst
+ return repo.rev_parse(str(id))
@classmethod
def new_from_sha(cls, repo, sha1):