forgejo/models/fixtures
oliverpool 937b8e8184
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_

(cherry picked from commit cb7ba8969d)
2023-05-16 07:42:22 +02:00
..
access.yml
access_token.yml
action.yml
attachment.yml
collaboration.yml
comment.yml
commit_status.yml
commit_status_index.yml
deleted_branch.yml
deploy_key.yml
email_address.yml
external_login_user.yml
follow.yml
gpg_key.yml
gpg_key_import.yml
hook_task.yml
issue.yml
issue_assignees.yml
issue_index.yml
issue_label.yml
issue_user.yml
issue_watch.yml
label.yml
lfs_meta_object.yml
login_source.yml
milestone.yml
notice.yml
notification.yml
oauth2_application.yml
oauth2_authorization_code.yml
oauth2_grant.yml
org_user.yml
project.yml
project_board.yml
project_issue.yml
protected_branch.yml
public_key.yml
pull_request.yml
reaction.yml
release.yml fix: release page for empty or non-existing target (#24659) 2023-05-16 07:42:22 +02:00
renamed_branch.yml
repo_archiver.yml
repo_indexer_status.yml
repo_redirect.yml
repo_topic.yml
repo_transfer.yml
repo_unit.yml fix calReleaseNumCommitsBehind (#24148) (#24197) 2023-04-22 12:30:24 -04:00
repository.yml fix calReleaseNumCommitsBehind (#24148) (#24197) 2023-04-22 12:30:24 -04:00
review.yml
star.yml
stopwatch.yml
system_setting.yml
team.yml
team_repo.yml
team_unit.yml
team_user.yml
topic.yml
tracked_time.yml
two_factor.yml
user.yml fix calReleaseNumCommitsBehind (#24148) (#24197) 2023-04-22 12:30:24 -04:00
user_open_id.yml
user_redirect.yml
watch.yml
webauthn_credential.yml
webhook.yml