From 5829522019fdf6e677dc6822809ddfb1af283836 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 11 May 2026 20:07:23 +0200 Subject: [PATCH] fix show correct mergebase (#37656) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary When comparing branches with **no common merge base** (e.g. unrelated histories or orphan branches), `PageIsComparePull` is false and `CommitCount` is zero. The compare template still showed `repo.commits.nothing_to_compare`, which in German reads like the branches are identical—even though the flash already explains there is no merge base. ## Changes - **`templates/repo/diff/compare.tmpl`**: Only render the grey “nothing to compare” segment when `CompareInfo.CompareBase` is set. --- Backport of https://github.com/go-gitea/gitea/pull/37651 Co-authored-by: Lunny Xiao --- templates/repo/diff/compare.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index 9ed4b73174d..a7b7f38e342 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -211,7 +211,7 @@ {{end}} {{else}}{{/* not singed-in or not for pull-request */}} - {{if not .CommitCount}} + {{if and (not .CommitCount) $.CompareInfo.MergeBase}}
{{ctx.Locale.Tr "repo.commits.nothing_to_compare"}}
{{end}} {{end}}