[v15.0/forgejo] fix: compare branches with names diff or patch (#12233)

**Backport:** https://codeberg.org/forgejo/forgejo/pulls/12227

Closes: Codeberg/Community#2538
Regression of: !5385

Co-authored-by: Robert Wolff <mahlzahn@posteo.de>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12233
Reviewed-by: Robert Wolff <mahlzahn@posteo.de>
This commit is contained in:
forgejo-backport-action 2026-04-23 01:28:54 +02:00 committed by Gusted
parent 2bd5fcbd2a
commit ab9856c92d
4 changed files with 20 additions and 7 deletions

View file

@ -0,0 +1 @@
f27c2b2b03dcab38beaf89b0ab4ff61f6de63441

View file

@ -0,0 +1 @@
f27c2b2b03dcab38beaf89b0ab4ff61f6de63441

View file

@ -239,6 +239,16 @@ func TestCompareBranches(t *testing.T) {
diffChanges = []string{"test.txt"}
inspectCompare(t, htmlDoc, diffCount, diffChanges)
// Branches with name 'diff' or 'patch'
req = NewRequest(t, "GET", "/user2/repo16/compare/master..diff")
session.MakeRequest(t, req, http.StatusOK)
req = NewRequest(t, "GET", "/user2/repo16/compare/master..diff.patch")
session.MakeRequest(t, req, http.StatusOK)
req = NewRequest(t, "GET", "/user2/repo16/compare/master..patch")
session.MakeRequest(t, req, http.StatusOK)
req = NewRequest(t, "GET", "/user2/repo16/compare/master..patch.diff")
session.MakeRequest(t, req, http.StatusOK)
}
func TestCompareWithPRsDisabled(t *testing.T) {