diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2016-09-11 11:23:22 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2016-09-11 11:23:22 +0200 |
commit | ae6e26ed4abac8b5e4e0a893da5546cd165d48e7 (patch) | |
tree | 9ad92cf202f39ea4aa991572cb7fae25760e405e /git | |
parent | df65f51de6ba67138a48185ff2e63077f7fe7ce6 (diff) | |
download | gitpython-ae6e26ed4abac8b5e4e0a893da5546cd165d48e7.tar.gz |
fix(tag): resolve `commit` objects deeply.
As TagObjects can point to other TagObjects, we need
to keep going in order to resolve the final commit.
Fixes #503
Diffstat (limited to 'git')
-rw-r--r-- | git/refs/tag.py | 14 |
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): |