1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00

Handle deleted base branch in PR (#10618) (#10619)

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
Lauris BH 2020-03-05 22:23:34 +02:00 committed by GitHub
parent c19ac41b34
commit 9a929ad17f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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