File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,17 @@ class TagReference(Reference):
2222
2323 @property
2424 def commit (self ):
25- """:return: Commit object the tag ref points to"""
25+ """:return: Commit object the tag ref points to
26+
27+ :raise ValueError: if the tag points to a tree or blob"""
2628 obj = self .object
2729 while obj .type != 'commit' :
2830 if obj .type == "tag" :
2931 # it is a tag object which carries the commit as an object - we can point to anything
3032 obj = obj .object
3133 else :
32- raise ValueError ("Tag %s points to a Blob or Tree - have never seen that before" % self )
34+ raise ValueError (("Cannot resolve commit as tag %s points to a %s object - "
35+ + "use the `.object` property instead to access it" ) % (self , obj .type ))
3336 return obj
3437
3538 @property
You can’t perform that action at this time.
0 commit comments