You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/routers
oliverpool cb7ba8969d
fix: release page for empty or non-existing target (#24659)
Backport #24470

Fixes #24145

---

To solve the bug, I added a "computed" `TargetBehind` field to the
`Release` model, which indicates the target branch of a release. This is
particularly useful if the target branch was deleted in the meantime (or
is empty).

I also did a micro-optimization in `calReleaseNumCommitsBehind`. Instead
of checking that a branch exists and then call `GetBranchCommit`, I
immediately call `GetBranchCommit` and handle the `git.ErrNotExist`
error.

This optimization is covered by the added unit test.

_contributed in the context of @forgejo_
2 years ago
..
api Fix api error message if fork exists (#24487) (#24493) 2 years ago
common Support sanitising the URL by removing extra slashes in the URL (#21333) (#23300) 2 years ago
install Set `X-Gitea-Debug` header once (#23361) (#23381) 2 years ago
private Refactor the setting to make unit test easier (#22405) 2 years ago
utils Implement FSFE REUSE for golang files (#21840) 2 years ago
web fix: release page for empty or non-existing target (#24659) 2 years ago
init.go Refactor `setting.Database.UseXXX` to methods (#23354) (#23356) 2 years ago