Skip to content

Commit

Permalink
Handle deleted base branch in PR (#10618) (#10619)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
lafriks committed Mar 5, 2020
1 parent c19ac41 commit 9a929ad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions routers/repo/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,16 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare
return nil
}
defer baseGitRepo.Close()

if !baseGitRepo.IsBranchExist(pull.BaseBranch) {
ctx.Data["IsPullRequestBroken"] = true
ctx.Data["BaseTarget"] = pull.BaseBranch
ctx.Data["HeadTarget"] = pull.HeadBranch
ctx.Data["NumCommits"] = 0
ctx.Data["NumFiles"] = 0
return nil
}

var headBranchExist bool
var headBranchSha string
// HeadRepo may be missing
Expand Down

0 comments on commit 9a929ad

Please sign in to comment.