aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-04-14 15:53:34 +0200
committerGitHub <noreply@github.com>2020-04-14 09:53:34 -0400
commit10e2f291442fdc7efc31c02f5ffcba79a36db9ac (patch)
tree5dbda60a983caf8d83ad7202755587acd692c212 /routers
parentc571c5bb286b925297f4eb32d130a5496126c3cb (diff)
downloadgitea-10e2f291442fdc7efc31c02f5ffcba79a36db9ac.tar.gz
gitea-10e2f291442fdc7efc31c02f5ffcba79a36db9ac.zip
Cache PullRequest Divergence (#10914)
* Cache PullRequest Divergence * only re-calc divergence if AddTestPullRequestTask() is exec * migrate already open pulls * finalize * take care of closed&not-merged+deleted-branch pull requests * fix nil pointer exeption Signed-off-by: 6543 <6543@obermui.de> * try this * no error its a warn * init gitea-repositories-meta * dont use gitDivergence type * CI.restart() * CI.restart() * CI.restart() * CI.restart() * check IsUserAllowedToUpdate independend from CommitsBehind
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/pull.go12
1 files changed, 1 insertions, 11 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index ef000208f4..00195fd02a 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -399,8 +399,6 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare
var headBranchSha string
// HeadRepo may be missing
if pull.HeadRepo != nil {
- var err error
-
headGitRepo, err := git.OpenRepository(pull.HeadRepo.RepoPath())
if err != nil {
ctx.ServerError("OpenRepository", err)
@@ -420,19 +418,11 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare
}
if headBranchExist {
- allowUpdate, err := pull_service.IsUserAllowedToUpdate(pull, ctx.User)
+ ctx.Data["UpdateAllowed"], err = pull_service.IsUserAllowedToUpdate(pull, ctx.User)
if err != nil {
ctx.ServerError("IsUserAllowedToUpdate", err)
return nil
}
- ctx.Data["UpdateAllowed"] = allowUpdate
-
- divergence, err := pull_service.GetDiverging(pull)
- if err != nil {
- ctx.ServerError("GetDiverging", err)
- return nil
- }
- ctx.Data["Divergence"] = divergence
ctx.Data["GetCommitMessages"] = pull_service.GetCommitMessages(pull)
}