diff --git a/routers/repo/compare.go b/routers/repo/compare.go index 198c75e652..622c911bbe 100644 --- a/routers/repo/compare.go +++ b/routers/repo/compare.go @@ -320,9 +320,6 @@ func PrepareCompareDiff( compareInfo.Commits = models.ParseCommitsWithStatus(compareInfo.Commits, headRepo) ctx.Data["Commits"] = compareInfo.Commits ctx.Data["CommitCount"] = compareInfo.Commits.Len() - if ctx.Data["CommitCount"] == 0 { - ctx.Data["PageIsComparePull"] = false - } if compareInfo.Commits.Len() == 1 { c := compareInfo.Commits.Front().Value.(models.SignCommitWithStatuses) diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index e98823953c..b088636434 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -59,7 +59,7 @@ {{if .IsNothingToCompare}}
{{.i18n.Tr "repo.pulls.nothing_to_compare"}}
- {{else if .PageIsComparePull}} + {{else if and .PageIsComparePull (gt .CommitCount 0)}} {{if .HasPullRequest}}
{{.i18n.Tr "repo.pulls.has_pull_request" $.RepoLink $.RepoRelPath .PullRequest.Index | Safe}}