1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Fix verifyCommits error when push a new branch (#26664)

> ### 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: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
CaiCandong
2023-08-30 10:27:53 +08:00
committed by GitHub
parent 508de3a58d
commit 815d267c80
43 changed files with 270 additions and 20 deletions

View File

@@ -0,0 +1,2 @@
x<01><>1
!ES{<7B><>AwGGa 9E<39>Qg W<10><><EFBFBD>#<23>A<EFBFBD><0F><><EFBFBD><EFBFBD>Z<18>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>p<EFBFBD><70>(<28>(<28><><EFBFBD><EFBFBD>Bh<42>ۼ&<26><11><14><><EFBFBD>:pLY`<60><><EFBFBD>U<EFBFBD><55>-<2D>z<EFBFBD><7A><EFBFBD><1A><>\<5C><>ZM:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>xJ/<2F>G}:<3A>3