summaryrefslogtreecommitdiff
path: root/lib/git/refs.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-14 19:34:45 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-14 19:34:45 +0200
commit6745f4542cfb74bbf3b933dba7a59ef2f54a4380 (patch)
treef897c537764a329dd9f09fa915b1bedc585bac62 /lib/git/refs.py
parenta28d3d18f9237af5101eb22e506a9ddda6d44025 (diff)
downloadgitpython-6745f4542cfb74bbf3b933dba7a59ef2f54a4380.tar.gz
test_blob: removed many redundant tests that would fail now as the mock cannot handle the complexity of the command backend
All objects but Tree now use the persistent command to read their object information - Trees get binary data and would need their own pretty-printing or they need to parse the data themselves which is my favorite
Diffstat (limited to 'lib/git/refs.py')
-rw-r--r--lib/git/refs.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/git/refs.py b/lib/git/refs.py
index df914b78..9754f65d 100644
--- a/lib/git/refs.py
+++ b/lib/git/refs.py
@@ -38,8 +38,10 @@ class Ref(LazyMixin, Iterable):
if attr == "object":
# have to be dynamic here as we may be a tag which can point to anything
# it uses our path to stay dynamic
- type_string = self.repo.git.cat_file(self.path, t=True).rstrip()
- self.object = get_object_type_by_name(type_string)(self.repo, self.path)
+ typename, size = self.repo.git.get_object_header(self.path)
+ # explicitly do not set the size as it may change if the our ref path points
+ # at some other place when the head changes for instance ...
+ self.object = get_object_type_by_name(typename)(self.repo, self.path)
else:
super(Ref, self)._set_cache_(attr)
@@ -124,9 +126,14 @@ class Ref(LazyMixin, Iterable):
id: [0-9A-Fa-f]{40}
Returns git.Head """
full_path, hexsha, type_name, object_size = line.split("\x00")
- obj = get_object_type_by_name(type_name)(repo, hexsha)
- obj.size = object_size
- return cls(repo, full_path, obj)
+
+ # No, we keep the object dynamic by allowing it to be retrieved by
+ # our path on demand - due to perstent commands it is fast
+ return cls(repo, full_path)
+
+ # obj = get_object_type_by_name(type_name)(repo, hexsha)
+ # obj.size = object_size
+ # return cls(repo, full_path, obj)
class Head(Ref):