0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-15 23:40:58 +02:00

fix show correct mergebase (#37656)

## 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.

<img width="1962" height="564"
src="https://github.com/user-attachments/assets/adc3b4a0-6f03-45da-b297-e15e5ad0aa79"
/>

---

Backport of https://github.com/go-gitea/gitea/pull/37651

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Nicolas 2026-05-11 20:07:23 +02:00 committed by GitHub
parent 5eaa0bc603
commit 5829522019
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -211,7 +211,7 @@
</div>
{{end}}
{{else}}{{/* not singed-in or not for pull-request */}}
{{if not .CommitCount}}
{{if and (not .CommitCount) $.CompareInfo.MergeBase}}
<div class="ui segment">{{ctx.Locale.Tr "repo.commits.nothing_to_compare"}}</div>
{{end}}
{{end}}