Skip to content

Commit

Permalink
Enable switching to a different source branch when PR already exists (#…
Browse files Browse the repository at this point in the history
…7823)

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
  • Loading branch information
saitho authored and lafriks committed Aug 11, 2019
1 parent 0fa9ea5 commit 24fa568
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions routers/repo/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down

0 comments on commit 24fa568

Please sign in to comment.