summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/branch.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-01-14 11:38:04 +0800
committerGitHub <noreply@github.com>2020-01-14 11:38:04 +0800
commit2677d071f911fb91f382acfedaedc251bd807f70 (patch)
tree61d48125ff6e509e5ffe385b23fdc14fb454b9e6 /routers/api/v1/repo/branch.go
parentbca367cecc6004957a952bb6222b9bbdc868e784 (diff)
downloadgitea-2677d071f911fb91f382acfedaedc251bd807f70.tar.gz
gitea-2677d071f911fb91f382acfedaedc251bd807f70.zip
Move newbranch to standalone package (#9627)
* Move newbranch to standalone package * move branch functions to modules to avoid dependencies cycles * fix tests * fix lint * fix lint
Diffstat (limited to 'routers/api/v1/repo/branch.go')
-rw-r--r--routers/api/v1/repo/branch.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/routers/api/v1/repo/branch.go b/routers/api/v1/repo/branch.go
index afc4763b52..8f8ca15877 100644
--- a/routers/api/v1/repo/branch.go
+++ b/routers/api/v1/repo/branch.go
@@ -11,6 +11,7 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/git"
+ repo_module "code.gitea.io/gitea/modules/repository"
api "code.gitea.io/gitea/modules/structs"
)
@@ -48,7 +49,7 @@ func GetBranch(ctx *context.APIContext) {
ctx.NotFound()
return
}
- branch, err := ctx.Repo.Repository.GetBranch(ctx.Repo.BranchName)
+ branch, err := repo_module.GetBranch(ctx.Repo.Repository, ctx.Repo.BranchName)
if err != nil {
if git.IsErrBranchNotExist(err) {
ctx.NotFound(err)
@@ -95,7 +96,7 @@ func ListBranches(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/BranchList"
- branches, err := ctx.Repo.Repository.GetBranches()
+ branches, err := repo_module.GetBranches(ctx.Repo.Repository)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetBranches", err)
return