1
1
mirror of https://github.com/go-gitea/gitea synced 2025-01-09 17:24:43 +00:00
oliverpool 8030614386
fix: release page for empty or non-existing target (#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.
2023-05-10 11:43:55 +08:00
..
2019-05-04 11:45:34 -04:00
2022-09-20 15:59:20 +08:00
2022-09-20 15:59:20 +08:00
2023-02-18 21:17:39 +02:00
2023-02-18 21:17:39 +02:00
2020-08-16 23:07:38 -04:00
2019-12-15 08:11:31 +00:00
2019-12-07 17:04:19 -05:00
2021-02-11 18:32:25 +01:00
2019-12-11 23:23:05 -05:00
2023-03-10 08:28:32 -06:00