mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
#3181 detect situation when base branch is deleted in pull request
This commit is contained in:
@ -235,6 +235,14 @@ func PrepareViewPullInfo(ctx *context.Context, pull *models.Issue) *git.PullRequ
|
||||
prInfo, err := headGitRepo.GetPullRequestInfo(models.RepoPath(repo.Owner.Name, repo.Name),
|
||||
pull.BaseBranch, pull.HeadBranch)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "fatal: Not a valid object name") {
|
||||
ctx.Data["IsPullReuqestBroken"] = true
|
||||
ctx.Data["BaseTarget"] = "deleted"
|
||||
ctx.Data["NumCommits"] = 0
|
||||
ctx.Data["NumFiles"] = 0
|
||||
return nil
|
||||
}
|
||||
|
||||
ctx.Handle(500, "GetPullRequestInfo", err)
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user