aboutsummaryrefslogtreecommitdiffstats
path: root/modules/repofiles/delete.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 /modules/repofiles/delete.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 'modules/repofiles/delete.go')
-rw-r--r--modules/repofiles/delete.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/repofiles/delete.go b/modules/repofiles/delete.go
index 43937c49e1..f774b375a5 100644
--- a/modules/repofiles/delete.go
+++ b/modules/repofiles/delete.go
@@ -10,6 +10,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/git"
+ repo_module "code.gitea.io/gitea/modules/repository"
api "code.gitea.io/gitea/modules/structs"
)
@@ -37,7 +38,7 @@ func DeleteRepoFile(repo *models.Repository, doer *models.User, opts *DeleteRepo
}
// oldBranch must exist for this operation
- if _, err := repo.GetBranch(opts.OldBranch); err != nil {
+ if _, err := repo_module.GetBranch(repo, opts.OldBranch); err != nil {
return nil, err
}
@@ -45,7 +46,7 @@ func DeleteRepoFile(repo *models.Repository, doer *models.User, opts *DeleteRepo
// Check to make sure the branch does not already exist, otherwise we can't proceed.
// If we aren't branching to a new branch, make sure user can commit to the given branch
if opts.NewBranch != opts.OldBranch {
- newBranch, err := repo.GetBranch(opts.NewBranch)
+ newBranch, err := repo_module.GetBranch(repo, opts.NewBranch)
if git.IsErrNotExist(err) {
return nil, err
}