diff options
author | zeripath <art27@cantab.net> | 2020-03-05 18:51:21 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-05 18:51:21 +0000 |
commit | 35027305d1713df3ce87a14e7cc632e4e495e02a (patch) | |
tree | 5b02ff3b3ea2dfd4af3211d488ba57c94cd33240 /routers/repo/pull.go | |
parent | ae452d024e592545338a720724a032f174902e80 (diff) | |
download | gitea-35027305d1713df3ce87a14e7cc632e4e495e02a.tar.gz gitea-35027305d1713df3ce87a14e7cc632e4e495e02a.zip |
Handle deleted base branch in PR (#10618)
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/repo/pull.go')
-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 e4fd19ee49..64bd8a03b8 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -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 |