From 144d99f0ea5074425bc0bc7e252eaec7b7ea7933 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 21 Jan 2024 20:14:08 +0800 Subject: [PATCH] Fix branch list bug which displayed default branch twice --- services/repository/branch.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/services/repository/branch.go b/services/repository/branch.go index 6ddc6badfa6e2..c1e6625ed4761 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 }