Skip to content

Commit 0e6fd0d

Browse files
authored
Fix branch list bug which displayed default branch twice (#28878)
Fix #28876
1 parent 49d7663 commit 0e6fd0d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

services/repository/branch.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,15 @@ func LoadBranches(ctx context.Context, repo *repo_model.Repository, gitRepo *git
6565
Page: page,
6666
PageSize: pageSize,
6767
},
68-
Keyword: keyword,
68+
Keyword: keyword,
69+
ExcludeBranchNames: []string{repo.DefaultBranch},
6970
}
7071

7172
dbBranches, totalNumOfBranches, err := db.FindAndCount[git_model.Branch](ctx, branchOpts)
7273
if err != nil {
7374
return nil, nil, 0, err
7475
}
7576

76-
branchOpts.ExcludeBranchNames = []string{repo.DefaultBranch}
77-
7877
if err := git_model.BranchList(dbBranches).LoadDeletedBy(ctx); err != nil {
7978
return nil, nil, 0, err
8079
}

0 commit comments

Comments
 (0)