aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git
diff options
context:
space:
mode:
authorRichard Mahn <richmahn@users.noreply.github.com>2019-06-29 06:44:17 -0400
committerzeripath <art27@cantab.net>2019-06-29 11:44:17 +0100
commit567e117df894c6d0307f4a026cafabb3220ac3d6 (patch)
treef0b91d813cbea28a198c6a0c190a554c35842466 /modules/git
parent7bd0dc4975a442cd8b28616b9c530d313ed1b685 (diff)
downloadgitea-567e117df894c6d0307f4a026cafabb3220ac3d6.tar.gz
gitea-567e117df894c6d0307f4a026cafabb3220ac3d6.zip
Fixes #7238 - Annotated tag commit ID incorrect (#7321)
* Fixes #7238 - Annotated tag commit ID incorrect * Fixes #7238 - Annotated tag commit ID incorrect
Diffstat (limited to 'modules/git')
-rw-r--r--modules/git/repo_tag.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/git/repo_tag.go b/modules/git/repo_tag.go
index df49e9acd6..6d490af9b5 100644
--- a/modules/git/repo_tag.go
+++ b/modules/git/repo_tag.go
@@ -141,9 +141,10 @@ func (repo *Repository) GetTagNameBySHA(sha string) (string, error) {
fields := strings.Fields(tagRef)
if strings.HasPrefix(fields[0], sha) && strings.HasPrefix(fields[1], TagPrefix) {
name := fields[1][len(TagPrefix):]
- // annotated tags show up twice, their name for commit ID is suffixed with ^{}
- name = strings.TrimSuffix(name, "^{}")
- return name, nil
+ // annotated tags show up twice, we should only return if is not the ^{} ref
+ if !strings.HasSuffix(name, "^{}") {
+ return name, nil
+ }
}
}
}