forgejo/routers/web/repo
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 Add run status in action view page () 2023-04-20 09:24:50 +02:00
activity.go
attachment.go Require repo scope for PATs for private repos and basic authentication () () 2023-04-26 20:57:51 -04:00
blame.go Sort repo topic labels by name () () 2023-04-17 09:00:19 +08:00
branch.go
cherry_pick.go
commit.go
compare.go Don't list root repository on compare page if pulls not allowed () () 2023-04-19 19:07:47 -04:00
download.go
editor.go
editor_test.go
find.go
http.go Require repo scope for PATs for private repos and basic authentication () () 2023-04-26 20:57:51 -04:00
http_test.go
issue.go Refresh the refernce of the closed PR when reopening () () 2023-05-08 12:48:06 +02:00
issue_content_history.go
issue_dependency.go
issue_label.go Make label templates have consistent behavior and priority () () 2023-04-12 16:05:10 +02:00
issue_label_test.go Make label templates have consistent behavior and priority () () 2023-04-12 16:05:10 +02:00
issue_lock.go
issue_stopwatch.go
issue_test.go
issue_timetrack.go
issue_watch.go
lfs.go
main_test.go
middlewares.go
migrate.go
milestone.go
packages.go
patch.go
projects.go
projects_test.go
pull.go
pull_review.go
release.go fix: release page for empty or non-existing target () 2023-05-12 14:14:41 -04:00
release_test.go fix: release page for empty or non-existing target () 2023-05-12 14:14:41 -04:00
render.go
repo.go Make label templates have consistent behavior and priority () () 2023-04-12 16:05:10 +02:00
runners.go
search.go
setting.go
setting_protected_branch.go
setting_secrets.go Only delete secrets belonging to its owner () () 2023-04-23 16:36:20 +02:00
settings_test.go
tag.go
topic.go
treelist.go
view.go Use correct locale key for forks page () () 2023-04-17 17:21:53 -04:00
view_test.go
webhook.go
wiki.go
wiki_test.go