Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-12-01 22:36:10 +01:00
forgejo/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_
2023-05-12 14:14:41 -04:00
..
api Fix api error message if fork exists (#24487) (#24493) 2023-05-03 08:15:56 -04:00
common Support sanitising the URL by removing extra slashes in the URL (#21333) (#23300) 2023-03-05 02:14:12 -05:00
install Set X-Gitea-Debug header once (#23361) (#23381) 2023-03-09 06:33:05 +08:00
private Refactor the setting to make unit test easier (#22405) 2023-02-20 00:12:01 +08:00
utils Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
web fix: release page for empty or non-existing target (#24659) 2023-05-12 14:14:41 -04:00
init.go Refactor setting.Database.UseXXX to methods (#23354) (#23356) 2023-03-07 20:11:44 +08:00