Skip to content

Commit 8bfeb85

Browse files
saitholunny
authored andcommitted
Enable switching to a different source branch when PR already exists (#7819)
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
1 parent 8101d80 commit 8bfeb85

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

routers/repo/compare.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ func CompareDiff(ctx *context.Context) {
292292
}
293293

294294
if ctx.Data["PageIsComparePull"] == true {
295+
headBranches, err := headGitRepo.GetBranches()
296+
if err != nil {
297+
ctx.ServerError("GetBranches", err)
298+
return
299+
}
300+
ctx.Data["HeadBranches"] = headBranches
301+
295302
pr, err := models.GetUnmergedPullRequest(headRepo.ID, ctx.Repo.Repository.ID, headBranch, baseBranch)
296303
if err != nil {
297304
if !models.IsErrPullRequestNotExist(err) {
@@ -312,13 +319,6 @@ func CompareDiff(ctx *context.Context) {
312319
return
313320
}
314321
}
315-
316-
headBranches, err := headGitRepo.GetBranches()
317-
if err != nil {
318-
ctx.ServerError("GetBranches", err)
319-
return
320-
}
321-
ctx.Data["HeadBranches"] = headBranches
322322
}
323323
beforeCommitID := ctx.Data["BeforeCommitID"].(string)
324324
afterCommitID := ctx.Data["AfterCommitID"].(string)

0 commit comments

Comments
 (0)