summaryrefslogtreecommitdiffstats
path: root/modules/convert
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-24 15:56:24 +0800
committerGitHub <noreply@github.com>2021-11-24 15:56:24 +0800
commitc97d66d23cf14e88514cccb88c393d21db51ab7a (patch)
tree625857bea77befb61847c01bf17aac1177255787 /modules/convert
parent754fdd8f9c2b1e4e78d507fd414968334cf586fd (diff)
downloadgitea-c97d66d23cf14e88514cccb88c393d21db51ab7a.tar.gz
gitea-c97d66d23cf14e88514cccb88c393d21db51ab7a.zip
Move repofiles from modules/repofiles to services/repository/files (#17774)
* Move repofiles from modules to services * rename services/repository/repofiles -> services/repository/files * Fix test Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'modules/convert')
-rw-r--r--modules/convert/pull.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/convert/pull.go b/modules/convert/pull.go
index ab17c13421..0f2b5af1b4 100644
--- a/modules/convert/pull.go
+++ b/modules/convert/pull.go
@@ -10,7 +10,6 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
- repo_module "code.gitea.io/gitea/modules/repository"
api "code.gitea.io/gitea/modules/structs"
)
@@ -83,7 +82,14 @@ func ToAPIPullRequest(pr *models.PullRequest, doer *models.User) *api.PullReques
},
}
- baseBranch, err = repo_module.GetBranch(pr.BaseRepo, pr.BaseBranch)
+ gitRepo, err := git.OpenRepository(pr.BaseRepo.RepoPath())
+ if err != nil {
+ log.Error("OpenRepository[%s]: %v", pr.BaseRepo.RepoPath(), err)
+ return nil
+ }
+ defer gitRepo.Close()
+
+ baseBranch, err = gitRepo.GetBranch(pr.BaseBranch)
if err != nil && !git.IsErrBranchNotExist(err) {
log.Error("GetBranch[%s]: %v", pr.BaseBranch, err)
return nil