1
0
Fork 0
forked from forgejo/forgejo

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

View file

@ -34,6 +34,22 @@ func ToBranch(repo *models.Repository, b *models.Branch, c *git.Commit) *api.Bra
}
}
// ToTag convert a tag to an api.Tag
func ToTag(repo *models.Repository, t *git.Tag) *api.Tag {
return &api.Tag{
Name: t.Name,
Commit: struct {
SHA string `json:"sha"`
URL string `json:"url"`
}{
SHA: t.ID.String(),
URL: util.URLJoin(repo.Link(), "commit", t.ID.String()),
},
ZipballURL: util.URLJoin(repo.Link(), "archive", t.Name+".zip"),
TarballURL: util.URLJoin(repo.Link(), "archive", t.Name+".tar.gz"),
}
}
// ToCommit convert a commit to api.PayloadCommit
func ToCommit(repo *models.Repository, c *git.Commit) *api.PayloadCommit {
authorUsername := ""