Explorar el Código

Handle deleted base branch in PR (#10618)

Signed-off-by: Andrew Thornton <art27@cantab.net>
tags/v1.10.5
zeripath hace 4 años
padre
commit
35027305d1
No account linked to committer's email address
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. 10
    0
      routers/repo/pull.go

+ 10
- 0
routers/repo/pull.go Ver fichero

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

Cargando…
Cancelar
Guardar