diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-02-07 20:00:52 +0800 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-02-07 12:00:52 +0000 |
commit | 01bbf5ea6940a1dc3793aaae2db2d85b1769432c (patch) | |
tree | 9bd5dbc9d0ffab32ec93334ad3f7e7eebe67a338 /routers/api/v1/convert/convert.go | |
parent | 2d213b64d1c897d7a0fdbc93e5cab90f84d7334a (diff) | |
download | gitea-01bbf5ea6940a1dc3793aaae2db2d85b1769432c.tar.gz gitea-01bbf5ea6940a1dc3793aaae2db2d85b1769432c.zip |
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
Diffstat (limited to 'routers/api/v1/convert/convert.go')
-rw-r--r-- | routers/api/v1/convert/convert.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/routers/api/v1/convert/convert.go b/routers/api/v1/convert/convert.go index 35416dea51..6569d21ab8 100644 --- a/routers/api/v1/convert/convert.go +++ b/routers/api/v1/convert/convert.go @@ -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 := "" |