Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-12-02 14:56:10 +01:00
forgejo/templates/repo/release
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
..
list.tmpl fix: release page for empty or non-existing target (#24659) 2023-05-16 07:42:22 +02:00
new.tmpl Title can be empty when creating tag only (#23917) (#23961) 2023-04-07 20:13:57 +08:00