mirror of
1
Fork 0
forgejo/routers
Giteabot 193e04c43b
Fix verifyCommits error when push a new branch (#26664) (#26810)
Backport #26664 by @CaiCandong

> ### Description
> If a new branch is pushed, and the repository has a rule that would
require signed commits for the new branch, the commit is rejected with a
500 error regardless of whether it's signed.
>
> When pushing a new branch, the "old" commit is the empty ID
(0000000000000000000000000000000000000000). verifyCommits has no
provision for this and passes an invalid commit range to git rev-list.
Prior to 1.19 this wasn't an issue because only pre-existing individual
branches could be protected.
>
> I was able to reproduce with
[try.gitea.io/CraigTest/test](https://try.gitea.io/CraigTest/test),
which is set up with a blanket rule to require commits on all branches.

Fix #25565
Very thanks to @Craig-Holmquist-NTI for reporting the bug and suggesting
an valid solution!

Co-authored-by: CaiCandong <50507092+CaiCandong@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit 93c36f395c)
2023-09-08 08:09:18 +02:00
..
api Include the GITHUB_TOKEN/GITEA_TOKEN secret for fork pull requests (#26759) (#26806) 2023-09-08 08:09:18 +02:00
common [BRANDING] Use `forgejo` binary name 2023-07-17 00:25:56 +02:00
install [BRANDING] Rebrand default config settings for new installs (#140) 2023-07-17 00:25:55 +02:00
private Fix verifyCommits error when push a new branch (#26664) (#26810) 2023-09-08 08:09:18 +02:00
utils Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
web Fix context filter has no effect in dashboard (#26695) (#26811) 2023-09-08 08:09:18 +02:00
init.go [API] Forgejo API /api/forgejo/v1 2023-07-16 23:44:22 +02:00