mirror of
1
Fork 0
forgejo/models
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
..
actions
activities
admin
asymkey
auth
avatars
db Improve milestone filter on issues page (#22423) (#24440) 2023-04-30 19:01:12 +02:00
dbfs
fixtures fix: release page for empty or non-existing target (#24659) 2023-05-12 14:14:41 -04:00
git Fix branch protection priority (#24045) (#24061) 2023-04-11 21:07:38 +02:00
issues Refresh the refernce of the closed PR when reopening (#24231) (#24587) 2023-05-08 12:48:06 +02:00
migrations
organization Fix owner team access mode value in team_unit table (#24224) 2023-04-22 08:53:03 +02:00
packages Use ghost user if package creator does not exist (#23822) (#23915) 2023-04-04 20:37:28 +08:00
perm
project
pull
repo fix: release page for empty or non-existing target (#24659) 2023-05-12 14:14:41 -04:00
secret
system
unit Rename actions unit to `repo.actions` and add docs for it (#23733) (#23881) 2023-04-03 12:54:36 +02:00
unittest
user Support "." char as user name for User/Orgs in RSS/ATOM/GPG/KEYS path ... (#23874) (#23878) 2023-04-07 18:10:17 +08:00
webhook
error.go
fixture_generation.go
fixture_test.go
main_test.go
migrate.go
migrate_test.go
org.go
org_team.go Remove org users who belong to no teams (#24247) (#24313) 2023-04-24 22:50:32 -04:00
org_team_test.go
org_test.go
repo.go
repo_collaboration.go
repo_collaboration_test.go
repo_test.go
repo_transfer.go
repo_transfer_test.go