aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository/branch.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-01-21 22:08:31 +0800
committerGitHub <noreply@github.com>2024-01-21 22:08:31 +0800
commit0e6fd0d1c1e31d22707e6f06124d5bf76361eaab (patch)
treee8ac1149e44617859a1333ddbce94c24b6528e46 /services/repository/branch.go
parent49d76639295a89bac8a656360782f0c3a1d2707c (diff)
downloadgitea-0e6fd0d1c1e31d22707e6f06124d5bf76361eaab.tar.gz
gitea-0e6fd0d1c1e31d22707e6f06124d5bf76361eaab.zip
Fix branch list bug which displayed default branch twice (#28878)
Fix #28876
Diffstat (limited to 'services/repository/branch.go')
-rw-r--r--services/repository/branch.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/services/repository/branch.go b/services/repository/branch.go
index 6ddc6badfa..c1e6625ed4 100644
--- a/services/repository/branch.go
+++ b/services/repository/branch.go
@@ -65,7 +65,8 @@ func LoadBranches(ctx context.Context, repo *repo_model.Repository, gitRepo *git
Page: page,
PageSize: pageSize,
},
- Keyword: keyword,
+ Keyword: keyword,
+ ExcludeBranchNames: []string{repo.DefaultBranch},
}
dbBranches, totalNumOfBranches, err := db.FindAndCount[git_model.Branch](ctx, branchOpts)
@@ -73,8 +74,6 @@ func LoadBranches(ctx context.Context, repo *repo_model.Repository, gitRepo *git
return nil, nil, 0, err
}
- branchOpts.ExcludeBranchNames = []string{repo.DefaultBranch}
-
if err := git_model.BranchList(dbBranches).LoadDeletedBy(ctx); err != nil {
return nil, nil, 0, err
}