Forgejo/tests
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
..
e2e Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
fuzz Move fuzz tests into tests/fuzz (#22376) 2023-01-09 15:30:14 +08:00
gitea-lfs-meta Test views of LFS files (#22196) 2022-12-23 07:41:56 +08:00
gitea-repositories-meta fix calReleaseNumCommitsBehind (#24148) (#24197) 2023-04-22 12:30:24 -04:00
integration fix: release page for empty or non-existing target (#24659) 2023-05-16 07:42:22 +02:00
mssql.ini.tmpl [CI] set PASSWORD_HASH_ALGO = argon2 for integration tests 2023-05-10 07:23:38 +02:00
mysql.ini.tmpl [CI] set PASSWORD_HASH_ALGO = argon2 for integration tests 2023-05-10 07:23:38 +02:00
mysql8.ini.tmpl [CI] set PASSWORD_HASH_ALGO = argon2 for integration tests 2023-05-10 07:23:38 +02:00
pgsql.ini.tmpl [CI] set PASSWORD_HASH_ALGO = argon2 for integration tests 2023-05-10 07:23:38 +02:00
sqlite.ini.tmpl [CI] set PASSWORD_HASH_ALGO = argon2 for integration tests 2023-05-10 07:23:38 +02:00
test_utils.go Refactor setting.Database.UseXXX to methods (#23354) (#23356) 2023-03-07 20:11:44 +08:00
testlogger.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00