1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-01 17:38:33 +00:00

Fixes #7238 - Annotated tag commit ID incorrect (#7321)

* Fixes #7238 - Annotated tag commit ID incorrect

* Fixes #7238 - Annotated tag commit ID incorrect
This commit is contained in:
Richard Mahn 2019-06-29 06:44:17 -04:00 committed by zeripath
parent 7bd0dc4975
commit 567e117df8
2 changed files with 5 additions and 4 deletions

View file

@ -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
}
}
}
}