mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-10 10:47:36 -05:00
Use git model to detect whether branch exist instead of gitrepo method (#35459)
This commit is contained in:
@@ -409,11 +409,11 @@ func RenameBranch(ctx context.Context, repo *repo_model.Repository, doer *user_m
|
||||
return "target_exist", nil
|
||||
}
|
||||
|
||||
if gitrepo.IsBranchExist(ctx, repo, to) {
|
||||
if exist, _ := git_model.IsBranchExist(ctx, repo.ID, to); exist {
|
||||
return "target_exist", nil
|
||||
}
|
||||
|
||||
if !gitrepo.IsBranchExist(ctx, repo, from) {
|
||||
if exist, _ := git_model.IsBranchExist(ctx, repo.ID, from); !exist {
|
||||
return "from_not_exist", nil
|
||||
}
|
||||
|
||||
@@ -624,7 +624,7 @@ func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, newB
|
||||
return nil
|
||||
}
|
||||
|
||||
if !gitrepo.IsBranchExist(ctx, repo, newBranchName) {
|
||||
if exist, _ := git_model.IsBranchExist(ctx, repo.ID, newBranchName); !exist {
|
||||
return git_model.ErrBranchNotExist{
|
||||
BranchName: newBranchName,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user