1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-21 12:44:49 -05:00

Handle deleted base branch in PR (#10618)

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath 2020-03-05 18:51:21 +00:00 committed by GitHub
parent ae452d024e
commit 35027305d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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