summaryrefslogtreecommitdiff
path: root/git
diff options
context:
space:
mode:
Diffstat (limited to 'git')
-rw-r--r--git/refs/tag.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/git/refs/tag.py b/git/refs/tag.py
index 3334e53c..11dbab97 100644
--- a/git/refs/tag.py
+++ b/git/refs/tag.py
@@ -24,13 +24,13 @@ class TagReference(Reference):
def commit(self):
""":return: Commit object the tag ref points to"""
obj = self.object
- if obj.type == "commit":
- return obj
- elif obj.type == "tag":
- # it is a tag object which carries the commit as an object - we can point to anything
- return obj.object
- else:
- raise ValueError("Tag %s points to a Blob or Tree - have never seen that before" % self)
+ while obj.type != 'commit':
+ if obj.type == "tag":
+ # it is a tag object which carries the commit as an object - we can point to anything
+ obj = obj.object
+ else:
+ raise ValueError("Tag %s points to a Blob or Tree - have never seen that before" % self)
+ return obj
@property
def tag(self):