| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -301,7 +301,13 @@ def rev_parse(repo: "Repo", rev: str) -> AnyGitObject: | |||
| 301 | 301 | ||
| 302 | 302 | # Handle type. | |
| 303 | 303 | if output_type == "commit": | |
| 304 | - pass # Default. | ||
| 304 | + obj = cast("TagObject", obj) | ||
| 305 | + if obj and obj.type == "tag": | ||
| 306 | + obj = deref_tag(obj) | ||
| 307 | + else: | ||
| 308 | + # Cannot do anything for non-tags. | ||
| 309 | + pass | ||
| 310 | + # END handle tag | ||
| 305 | 311 | elif output_type == "tree": | |
| 306 | 312 | try: | |
| 307 | 313 | obj = cast(AnyGitObject, obj) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1064,9 +1064,9 @@ def test_rev_parse(self): | |||
| 1064 | 1064 | # TODO: Dereference tag into a blob 0.1.7^{blob} - quite a special one. | |
| 1065 | 1065 | # Needs a tag which points to a blob. | |
| 1066 | 1066 | ||
| 1067 | - # ref^0 returns commit being pointed to, same with ref~0, and ^{} | ||
| 1067 | + # ref^0 returns commit being pointed to, same with ref~0, ^{}, and ^{commit} | ||
| 1068 | 1068 | tag = rev_parse("0.1.4") | |
| 1069 | - for token in ("~0", "^0", "^{}"): | ||
| 1069 | + for token in ("~0", "^0", "^{}", "^{commit}"): | ||
| 1070 | 1070 | self.assertEqual(tag.object, rev_parse("0.1.4%s" % token)) | |
| 1071 | 1071 | # END handle multiple tokens | |
| 1072 | 1072 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments