gitea/routers/private
Giteabot 93c36f395c
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>
2023-08-31 15:29:55 +00:00
..
tests/repos Fix verifyCommits error when push a new branch (#26664) (#26810) 2023-08-31 15:29:55 +00:00
actions.go parseScope with owner/repo always sets owner to zero (#25987) (#25989) 2023-07-19 22:57:17 +08:00
default_branch.go Refactor internal API for git commands, use meaningful messages instead of "Internal Server Error" (#23687) 2023-03-29 14:32:26 +08:00
hook_post_receive.go Use the type RefName for all the needed places and fix pull mirror sync bugs (#24634) 2023-05-26 01:04:48 +00:00
hook_pre_receive.go Use the type RefName for all the needed places and fix pull mirror sync bugs (#24634) 2023-05-26 01:04:48 +00:00
hook_proc_receive.go Refactor internal API for git commands, use meaningful messages instead of "Internal Server Error" (#23687) 2023-03-29 14:32:26 +08:00
hook_verification.go Fix verifyCommits error when push a new branch (#26664) (#26810) 2023-08-31 15:29:55 +00:00
hook_verification_test.go Fix verifyCommits error when push a new branch (#26664) (#26810) 2023-08-31 15:29:55 +00:00
internal.go Add gitea manager reload-templates command (#24843) 2023-05-22 23:51:40 +08:00
internal_repo.go Refactor internal API for git commands, use meaningful messages instead of "Internal Server Error" (#23687) 2023-03-29 14:32:26 +08:00
key.go Refactor internal API for git commands, use meaningful messages instead of "Internal Server Error" (#23687) 2023-03-29 14:32:26 +08:00
mail.go Prevent multiple `To` recipients (#22566) 2023-01-22 08:23:52 -06:00
main_test.go Fix verifyCommits error when push a new branch (#26664) (#26810) 2023-08-31 15:29:55 +00:00
manager.go Fix logger refactoring regression: manager logging add (#24847) 2023-05-24 08:09:33 +08:00
manager_process.go Replace `interface{}` with `any` (#25686) (#25687) 2023-07-04 23:41:32 -04:00
manager_unix.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
manager_windows.go Refactor internal API for git commands, use meaningful messages instead of "Internal Server Error" (#23687) 2023-03-29 14:32:26 +08:00
restore_repo.go Fix regression: access log template, gitea manager cli command (#24838) 2023-05-22 09:38:38 +08:00
serv.go Refactor internal API for git commands, use meaningful messages instead of "Internal Server Error" (#23687) 2023-03-29 14:32:26 +08:00
ssh_log.go Refactor the setting to make unit test easier (#22405) 2023-02-20 00:12:01 +08:00