forgejo/models
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
..
actions
activities
admin
asymkey
auth
avatars Avoid warning for system setting when start up (#23054) 2023-02-24 18:23:13 +08:00
db
dbfs
fixtures fix: release page for empty or non-existing target (#24470) 2023-05-10 11:43:55 +08:00
git
issues Refresh the refernce of the closed PR when reopening (#24231) 2023-05-08 14:39:32 +08:00
migrations
organization
packages
perm
project
pull
repo fix: release page for empty or non-existing target (#24470) 2023-05-10 11:43:55 +08:00
secret
system
unit
unittest
user
webhook
error.go
fixture_generation.go
fixture_test.go
main_test.go
migrate.go
migrate_test.go
org.go
org_team.go
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