]> source.dussan.org Git - gitea.git/commitdiff
should run RetrieveRepoMetas() for empty pr (#15187)
authora1012112796 <1012112796@qq.com>
Mon, 29 Mar 2021 06:58:48 +0000 (14:58 +0800)
committerGitHub <noreply@github.com>
Mon, 29 Mar 2021 06:58:48 +0000 (07:58 +0100)
Signed-off-by: a1012112796 <1012112796@qq.com>
routers/repo/compare.go

index a8f4f8add8d67c6867f940e737f26b82073d7aea..38c3005cf744ca4705e9215f38e314e72fd799b0 100644 (file)
@@ -431,11 +431,15 @@ func PrepareCompareDiff(
                ctx.Data["IsNothingToCompare"] = true
                if unit, err := repo.GetUnit(models.UnitTypePullRequests); err == nil {
                        config := unit.PullRequestsConfig()
+
                        if !config.AutodetectManualMerge {
-                               ctx.Data["AllowEmptyPr"] = !(baseBranch == headBranch && ctx.Repo.Repository.Name == headRepo.Name)
-                       } else {
-                               ctx.Data["AllowEmptyPr"] = false
+                               allowEmptyPr := !(baseBranch == headBranch && ctx.Repo.Repository.Name == headRepo.Name)
+                               ctx.Data["AllowEmptyPr"] = allowEmptyPr
+
+                               return !allowEmptyPr
                        }
+
+                       ctx.Data["AllowEmptyPr"] = false
                }
                return true
        }