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:
Lunny Xiao 2019-02-07 20:00:52 +08:00 committed by zeripath
parent 2d213b64d1
commit 01bbf5ea69
9 changed files with 216 additions and 14 deletions

16
vendor/code.gitea.io/git/repo_tag.go generated vendored
View file

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