forgejo/models
oliverpool cb7ba8969d
fix: release page for empty or non-existing target ()
Backport 

Fixes 

---

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 Refactor the setting to make unit test easier () 2023-02-20 00:12:01 +08:00
auth
avatars
db
dbfs
fixtures fix: release page for empty or non-existing target () 2023-05-12 14:14:41 -04:00
git
issues
migrations
organization
packages
perm
project
pull
repo fix: release page for empty or non-existing target () 2023-05-12 14:14:41 -04: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