summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorMario Lubenka <mario.lubenka@googlemail.com>2019-08-11 17:23:49 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2019-08-11 23:23:49 +0800
commit8bfeb85f93ccd41289f901977243258e1b69f4d6 (patch)
treec93e55debbc60da4b9d2df577901fa57c42c79a9 /routers
parent8101d803e61bf7f64c5e19b5a5d1f4dd9e81892a (diff)
downloadgitea-8bfeb85f93ccd41289f901977243258e1b69f4d6.tar.gz
gitea-8bfeb85f93ccd41289f901977243258e1b69f4d6.zip
Enable switching to a different source branch when PR already exists (#7819)
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/compare.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/routers/repo/compare.go b/routers/repo/compare.go
index a85084791d..193255ca6c 100644
--- a/routers/repo/compare.go
+++ b/routers/repo/compare.go
@@ -292,6 +292,13 @@ func CompareDiff(ctx *context.Context) {
}
if ctx.Data["PageIsComparePull"] == true {
+ headBranches, err := headGitRepo.GetBranches()
+ if err != nil {
+ ctx.ServerError("GetBranches", err)
+ return
+ }
+ ctx.Data["HeadBranches"] = headBranches
+
pr, err := models.GetUnmergedPullRequest(headRepo.ID, ctx.Repo.Repository.ID, headBranch, baseBranch)
if err != nil {
if !models.IsErrPullRequestNotExist(err) {
@@ -312,13 +319,6 @@ func CompareDiff(ctx *context.Context) {
return
}
}
-
- headBranches, err := headGitRepo.GetBranches()
- if err != nil {
- ctx.ServerError("GetBranches", err)
- return
- }
- ctx.Data["HeadBranches"] = headBranches
}
beforeCommitID := ctx.Data["BeforeCommitID"].(string)
afterCommitID := ctx.Data["AfterCommitID"].(string)