Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit15b6bba

Browse files
committed
fix(tag): improve tag resolution handling
The handling is similar, but the error message makes clearwhat is happening, and what can be done to handle such a case.Related to#561
1 parentc823d48 commit15b6bba

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎git/refs/tag.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ class TagReference(Reference):
2222

2323
@property
2424
defcommit(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
whileobj.type!='commit':
2830
ifobj.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-
raiseValueError("Tag %s points to a Blob or Tree - have never seen that before"%self)
34+
raiseValueError(("Cannot resolve commit as tag %s points to a %s object - "
35+
+"use the `.object` property instead to access it")% (self,obj.type))
3336
returnobj
3437

3538
@property

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp