浏览代码

Handle deleted base branch in PR (#10618)

Signed-off-by: Andrew Thornton <art27@cantab.net>
tags/v1.10.5
zeripath 4 年前
父节点
当前提交
35027305d1
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10
    0
      routers/repo/pull.go

+ 10
- 0
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

正在加载...
取消
保存