diff options
author | Lauris BH <lauris@nix.lv> | 2020-03-05 22:23:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-05 22:23:34 +0200 |
commit | 9a929ad17fe1f110d45b83e00e6f0068fcbc1b60 (patch) | |
tree | e7a17c98484da24d1658df85eb04a07b7a7e3a6f | |
parent | c19ac41b34fa327aee3e10cb01bfbe539b32705d (diff) | |
download | gitea-9a929ad17fe1f110d45b83e00e6f0068fcbc1b60.tar.gz gitea-9a929ad17fe1f110d45b83e00e6f0068fcbc1b60.zip |
Handle deleted base branch in PR (#10618) (#10619)
Signed-off-by: Andrew Thornton <art27@cantab.net>
-rw-r--r-- | routers/repo/pull.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go index c8c35ae917..1e2d60d727 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -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 |