From 61308825a63a3810cd7db7b7ba845527a2b26c6f Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Tue, 30 Mar 2021 00:02:01 +0800 Subject: [PATCH] should run RetrieveRepoMetas() for empty pr (#15187) (#15190) Signed-off-by: a1012112796 <1012112796@qq.com> --- routers/repo/compare.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/routers/repo/compare.go b/routers/repo/compare.go index a8f4f8add..38c3005cf 100644 --- a/routers/repo/compare.go +++ b/routers/repo/compare.go @@ -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 }