mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-06-07 12:58:16 +08:00
Add API to list tags (#5850)
* Add API to list tags * update dependency gitea sdk vendor * fix swagger generation * fix swagger * add tests * update code.gitea.io/git vendor
This commit is contained in:
16
vendor/code.gitea.io/git/repo_tag.go
generated
vendored
16
vendor/code.gitea.io/git/repo_tag.go
generated
vendored
@ -103,26 +103,18 @@ func (repo *Repository) GetTagInfos() ([]*Tag, error) {
|
||||
}
|
||||
|
||||
tagNames := strings.Split(stdout, "\n")
|
||||
var tags []*Tag
|
||||
var tags = make([]*Tag, 0, len(tagNames))
|
||||
for _, tagName := range tagNames {
|
||||
tagName = strings.TrimSpace(tagName)
|
||||
if len(tagName) == 0 {
|
||||
continue
|
||||
}
|
||||
commitID, err := NewCommand("rev-parse", tagName).RunInDir(repo.Path)
|
||||
|
||||
tag, err := repo.GetTag(tagName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
commit, err := repo.GetCommit(commitID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tags = append(tags, &Tag{
|
||||
Name: tagName,
|
||||
Message: commit.Message(),
|
||||
Object: commit.ID,
|
||||
Tagger: commit.Author,
|
||||
})
|
||||
tags = append(tags, tag)
|
||||
}
|
||||
sortTagsByTime(tags)
|
||||
return tags, nil
|
||||
|
Reference in New Issue
Block a user