mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-05 01:46:25 +02:00
Refactor Branch struct in package modules/git (#33980)
The `Branch` struct in `modules/git` package is unnecessary. We can just use a `string` to represent a branch
This commit is contained in:
1 parent
285950a222
commit
c27d87a9ac
16 files changed
+169
-147
No files matched your search
@@ -817,9 +817,9 @@ func RepoRefByType(detectRefType git.RefType) func(*Context) {
|
||||
if reqPath == "" {
|
||||
refShortName = ctx.Repo.Repository.DefaultBranch
|
||||
if !gitrepo.IsBranchExist(ctx, ctx.Repo.Repository, refShortName) {
|
||||
brs, _, err := ctx.Repo.GitRepo.GetBranches(0, 1)
|
||||
brs, _, err := ctx.Repo.GitRepo.GetBranchNames(0, 1)
|
||||
if err == nil && len(brs) != 0 {
|
||||
refShortName = brs[0].Name
|
||||
refShortName = brs[0]
|
||||
} else if len(brs) == 0 {
|
||||
log.Error("No branches in non-empty repository %s", ctx.Repo.GitRepo.Path)
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user