| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c823d48 commit 15b6bba
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,14 +22,17 @@ class TagReference(Reference): | |||
| 22 | 22 | ||
| 23 | 23 | @property | |
| 24 | 24 | 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""" | ||
| 26 | 28 | obj = self.object | |
| 27 | 29 | while obj.type != 'commit': | |
| 28 | 30 | if obj.type == "tag": | |
| 29 | 31 | # it is a tag object which carries the commit as an object - we can point to anything | |
| 30 | 32 | obj = obj.object | |
| 31 | 33 | 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)) | ||
| 33 | 36 | return obj | |
| 34 | 37 | ||
| 35 | 38 | @property | |
| Back | FazBrowse Home | New Git URL |
0 commit comments