diff options
author | Antoine GIRARD <sapk@sapk.fr> | 2016-01-28 20:49:05 +0100 |
---|---|---|
committer | Antoine GIRARD <sapk@sapk.fr> | 2016-01-28 20:51:19 +0100 |
commit | b7b30cd85e5cabd9d643013ffb10dafd133b18ea (patch) | |
tree | 64c950a4add6d9482d3dd4daebaea5e1839eb866 /routers/api/v1/convert | |
parent | 81e5722bcc80e560f4e50874a9319f5c5fd3c0f3 (diff) | |
download | gitea-b7b30cd85e5cabd9d643013ffb10dafd133b18ea.tar.gz gitea-b7b30cd85e5cabd9d643013ffb10dafd133b18ea.zip |
Corrections following recommendations
Diffstat (limited to 'routers/api/v1/convert')
-rw-r--r-- | routers/api/v1/convert/convert.go | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/routers/api/v1/convert/convert.go b/routers/api/v1/convert/convert.go index d20732bfd6..57b3d44e2c 100644 --- a/routers/api/v1/convert/convert.go +++ b/routers/api/v1/convert/convert.go @@ -16,26 +16,6 @@ import ( "github.com/gogits/gogs/modules/setting" ) -// ToApiBranch converts user to its API format. -func ToApiBranch(b *models.Branch,c *git.Commit) *api.Branch { - return &api.Branch{ - Name: b.Name, - Commit: ToApiCommit(c), - } -} -// ToApiCommit converts user to its API format. -func ToApiCommit(c *git.Commit) *api.PayloadCommit { - return &api.PayloadCommit{ - ID: c.ID.String(), - Message: c.Message(), - URL: "Not implemented", - Author: &api.PayloadAuthor{ - Name: c.Committer.Name, - Email: c.Committer.Email, - /* UserName: c.Committer.UserName, */ - }, - } -} // ToApiUser converts user to its API format. func ToApiUser(u *models.User) *api.User { return &api.User{ @@ -71,6 +51,28 @@ func ToApiRepository(owner *models.User, repo *models.Repository, permission api } } +// ToApiBranch converts user to its API format. +func ToApiBranch(b *models.Branch,c *git.Commit) *api.Branch { + return &api.Branch{ + Name: b.Name, + Commit: ToApiCommit(c), + } +} + +// ToApiCommit converts user to its API format. +func ToApiCommit(c *git.Commit) *api.PayloadCommit { + return &api.PayloadCommit{ + ID: c.ID.String(), + Message: c.Message(), + URL: "Not implemented", + Author: &api.PayloadAuthor{ + Name: c.Committer.Name, + Email: c.Committer.Email, + /* UserName: c.Committer.UserName, */ + }, + } +} + // ToApiPublicKey converts public key to its API format. func ToApiPublicKey(apiLink string, key *models.PublicKey) *api.PublicKey { return &api.PublicKey{ |