Move get/set default branch from git package to gitrepo package to hide repopath (#29126)
This commit is contained in:
parent
a1f5dd7677
commit
25b842df26
15 changed files with 52 additions and 63 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/gitrepo"
|
||||
"code.gitea.io/gitea/modules/private"
|
||||
gitea_context "code.gitea.io/gitea/services/context"
|
||||
)
|
||||
|
@ -20,7 +21,7 @@ func SetDefaultBranch(ctx *gitea_context.PrivateContext) {
|
|||
branch := ctx.Params(":branch")
|
||||
|
||||
ctx.Repo.Repository.DefaultBranch = branch
|
||||
if err := ctx.Repo.GitRepo.SetDefaultBranch(ctx.Repo.Repository.DefaultBranch); err != nil {
|
||||
if err := gitrepo.SetDefaultBranch(ctx, ctx.Repo.Repository, ctx.Repo.Repository.DefaultBranch); err != nil {
|
||||
if !git.IsErrUnsupportedVersion(err) {
|
||||
ctx.JSON(http.StatusInternalServerError, private.Response{
|
||||
Err: fmt.Sprintf("Unable to set default branch on repository: %s/%s Error: %v", ownerName, repoName, err),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue