aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository/branch.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-12-11 16:56:48 +0800
committerGitHub <noreply@github.com>2023-12-11 16:56:48 +0800
commit537fa6996214ef42348cfe89bab6f2e04380aeac (patch)
tree2b1d7a5b05b5da1c2cd30f400fd3ca648729c6f5 /services/repository/branch.go
parent0abb5633e34fd14c2d49de0b4c98f7ba7d98a37e (diff)
downloadgitea-537fa6996214ef42348cfe89bab6f2e04380aeac.tar.gz
gitea-537fa6996214ef42348cfe89bab6f2e04380aeac.zip
Second part of refactor `db.Find` (#28194)
Continue of #27798 and move more functions to `db.Find` and `db.Count`.
Diffstat (limited to 'services/repository/branch.go')
-rw-r--r--services/repository/branch.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/services/repository/branch.go b/services/repository/branch.go
index 6dc286675f..b3dbb252ca 100644
--- a/services/repository/branch.go
+++ b/services/repository/branch.go
@@ -66,22 +66,17 @@ func LoadBranches(ctx context.Context, repo *repo_model.Repository, gitRepo *git
Keyword: keyword,
}
- totalNumOfBranches, err := git_model.CountBranches(ctx, branchOpts)
+ dbBranches, totalNumOfBranches, err := db.FindAndCount[git_model.Branch](ctx, branchOpts)
if err != nil {
return nil, nil, 0, err
}
branchOpts.ExcludeBranchNames = []string{repo.DefaultBranch}
- dbBranches, err := git_model.FindBranches(ctx, branchOpts)
- if err != nil {
- return nil, nil, 0, err
- }
-
- if err := dbBranches.LoadDeletedBy(ctx); err != nil {
+ if err := git_model.BranchList(dbBranches).LoadDeletedBy(ctx); err != nil {
return nil, nil, 0, err
}
- if err := dbBranches.LoadPusher(ctx); err != nil {
+ if err := git_model.BranchList(dbBranches).LoadPusher(ctx); err != nil {
return nil, nil, 0, err
}