summaryrefslogtreecommitdiffstats
path: root/modules/convert/git_commit.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-12-10 09:27:50 +0800
committerGitHub <noreply@github.com>2021-12-10 09:27:50 +0800
commit719bddcd76610a63dadc8555760072957a11cf30 (patch)
tree0df26092fba7e3e21444fe493e6b349473b6b0cb /modules/convert/git_commit.go
parentfb8166c6c6b652a0e6fa98681780a6a71090faf3 (diff)
downloadgitea-719bddcd76610a63dadc8555760072957a11cf30.tar.gz
gitea-719bddcd76610a63dadc8555760072957a11cf30.zip
Move repository model into models/repo (#17933)
* Some refactors related repository model * Move more methods out of repository * Move repository into models/repo * Fix test * Fix test * some improvements * Remove unnecessary function
Diffstat (limited to 'modules/convert/git_commit.go')
-rw-r--r--modules/convert/git_commit.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/convert/git_commit.go b/modules/convert/git_commit.go
index 3148d880ff..55cac5fd58 100644
--- a/modules/convert/git_commit.go
+++ b/modules/convert/git_commit.go
@@ -8,7 +8,7 @@ import (
"net/url"
"time"
- "code.gitea.io/gitea/models"
+ repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
@@ -28,7 +28,7 @@ func ToCommitUser(sig *git.Signature) *api.CommitUser {
}
// ToCommitMeta convert a git.Tag to an api.CommitMeta
-func ToCommitMeta(repo *models.Repository, tag *git.Tag) *api.CommitMeta {
+func ToCommitMeta(repo *repo_model.Repository, tag *git.Tag) *api.CommitMeta {
return &api.CommitMeta{
SHA: tag.Object.String(),
URL: util.URLJoin(repo.APIURL(), "git/commits", tag.ID.String()),
@@ -37,7 +37,7 @@ func ToCommitMeta(repo *models.Repository, tag *git.Tag) *api.CommitMeta {
}
// ToPayloadCommit convert a git.Commit to api.PayloadCommit
-func ToPayloadCommit(repo *models.Repository, c *git.Commit) *api.PayloadCommit {
+func ToPayloadCommit(repo *repo_model.Repository, c *git.Commit) *api.PayloadCommit {
authorUsername := ""
if author, err := user_model.GetUserByEmail(c.Author.Email); err == nil {
authorUsername = author.Name
@@ -72,7 +72,7 @@ func ToPayloadCommit(repo *models.Repository, c *git.Commit) *api.PayloadCommit
}
// ToCommit convert a git.Commit to api.Commit
-func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string]*user_model.User) (*api.Commit, error) {
+func ToCommit(repo *repo_model.Repository, commit *git.Commit, userCache map[string]*user_model.User) (*api.Commit, error) {
var apiAuthor, apiCommitter *api.User