]> source.dussan.org Git - gitea.git/commitdiff
When the git ref is unable to be found return broken pr (#13218)
authorzeripath <art27@cantab.net>
Tue, 20 Oct 2020 12:52:54 +0000 (13:52 +0100)
committerGitHub <noreply@github.com>
Tue, 20 Oct 2020 12:52:54 +0000 (20:52 +0800)
Fix #13216

Signed-off-by: Andrew Thornton <art27@cantab.net>
routers/repo/pull.go

index 54da7b76b7edff18b7ffd7e5671296e0d7f41208..0ae126215ab4cecf44518297800664762f2f91af 100644 (file)
@@ -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