mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-23 20:01:34 +00:00
Move commit related functions to gitrepo package (#35600)
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/modules/cache"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/gitrepo"
|
||||
)
|
||||
|
||||
// CacheRef cachhe last commit information of the branch or the tag
|
||||
@@ -19,7 +20,9 @@ func CacheRef(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Rep
|
||||
}
|
||||
|
||||
if gitRepo.LastCommitCache == nil {
|
||||
commitsCount, err := cache.GetInt64(repo.GetCommitsCountCacheKey(fullRefName.ShortName(), true), commit.CommitsCount)
|
||||
commitsCount, err := cache.GetInt64(repo.GetCommitsCountCacheKey(fullRefName.ShortName(), true), func() (int64, error) {
|
||||
return gitrepo.CommitsCountOfCommit(ctx, repo, commit.ID.String())
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user