| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d8a4958 commit 5372b44
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -266,16 +266,15 @@ def rev_parse(repo: "Repo", rev: str) -> AnyGitObject: | |||
| 266 | 266 | parsed_to = 0 | |
| 267 | 267 | lr = len(rev) | |
| 268 | 268 | while start < lr: | |
| 269 | + at_points_to_reflog = False | ||
| 269 | 270 | if rev[start] not in "^~:@": | |
| 270 | 271 | start += 1 | |
| 271 | 272 | continue | |
| 272 | 273 | if rev[start] == "@": | |
| 273 | 274 | next_char = rev[start + 1] if start + 1 < lr else None | |
| 274 | - if start == 0: | ||
| 275 | - if next_char not in (None, "{", "^", "~", ":"): | ||
| 276 | - start += 1 | ||
| 277 | - continue | ||
| 278 | - elif next_char != "{": | ||
| 275 | + at_points_to_reflog = next_char == "{" | ||
| 276 | + is_head_shorthand = start == 0 and next_char in (None, "^", "~", ":") | ||
| 277 | + if not (at_points_to_reflog or is_head_shorthand): | ||
| 279 | 278 | start += 1 | |
| 280 | 279 | continue | |
| 281 | 280 | # END handle start | |
@@ -301,7 +300,7 @@ def rev_parse(repo: "Repo", rev: str) -> AnyGitObject: | |||
| 301 | 300 | ||
| 302 | 301 | start += 1 | |
| 303 | 302 | ||
| 304 | - if token == "@" and (start >= lr or rev[start] != "{"): | ||
| 303 | + if token == "@" and not at_points_to_reflog: | ||
| 305 | 304 | obj = cast(AnyGitObject, ref.commit) | |
| 306 | 305 | ref = None | |
| 307 | 306 | parsed_to = start | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -159,6 +159,7 @@ def test_commit_from_tag_starting_with_at(self, rw_dir): | |||
| 159 | 159 | commit = repo.index.commit("init") | |
| 160 | 160 | repo.create_tag("@foo") | |
| 161 | 161 | ||
| 162 | + self.assertEqual(repo.tags["@foo"].commit, commit) | ||
| 162 | 163 | self.assertEqual(repo.commit("@"), commit) | |
| 163 | 164 | self.assertEqual(repo.commit("@foo"), commit) | |
| 164 | 165 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments