From d795bfc9646069137d607d3d4770b956e0a48f7a Mon Sep 17 00:00:00 2001 From: zeripath Date: Sun, 25 Oct 2020 23:10:09 +0000 Subject: [PATCH] When the git ref is unable to be found return broken pr (#13218) (#13303) Backport #13218 Fix #13216 Signed-off-by: Andrew Thornton --- routers/repo/pull.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/pull.go b/routers/repo/pull.go index f5c3aec0f8..1b3f835e4f 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -311,7 +311,7 @@ func PrepareMergedViewPullInfo(ctx *context.Context, issue *models.Issue) *git.C compareInfo, err := ctx.Repo.GitRepo.GetCompareInfo(ctx.Repo.Repository.RepoPath(), pull.MergeBase, pull.GetGitRefName()) if err != nil { - if strings.Contains(err.Error(), "fatal: Not a valid object name") { + if strings.Contains(err.Error(), "fatal: Not a valid object name") || strings.Contains(err.Error(), "unknown revision or path not in the working tree") { ctx.Data["IsPullRequestBroken"] = true ctx.Data["BaseTarget"] = pull.BaseBranch ctx.Data["NumCommits"] = 0