Skip to content

Commit

Permalink
Handle deleted base branch in PR (#10618)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath authored Mar 5, 2020
1 parent ae452d0 commit 3502730
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 @@ -356,6 +356,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 3502730

Please sign in to comment.