Closed
Description
Description
I was testing how branch protection works and if it is possible to protect modification of .gitea/actions
from being modified in a PR. As far as I understand, Gitea is executing actions code from a PR, and not from main
, but this must be another issue.
Here is the following bug.
If branch protection is set for branch *
all pushes to new branches will fail with "Gitea: Internal Server Error (no message for end users)
"
How to reproduce:
- Create a branch protection for branch
*
, set protected files to.gitea/**;mkdocs.yml;mkdocs.yaml
, push -Enable Push
- clone repo via ssh, and do:
$ git branch pr-test
$ git checkout pr-test
Switched to branch 'pr-test'
$ touch text.txt
$ git add text.txt
$ git commit -m 'test add file'
[pr-test 665f1b8] test add file
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 text.txt
$ git push origin pr-test
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 16 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 257 bytes | 257.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
remote:
remote: Gitea: Internal Server Error (no message for end users)
To demo.gitea.com:f403/GetAffectedFiles-test.git
! [remote rejected] pr-test -> pr-test (pre-receive hook declined)
error: failed to push some refs to 'demo.gitea.com:f403/GetAffectedFiles-test.git'
(Without protected files it works - this is how a new branch was created on demo.gitea)
gitea.log
has following entries (hashes are differ from example above):
2024/07/30 07:41:54 ...ules/context/repo.go:643:RepoAssignment() [E] RepoAssignment Invalid repo /data/git/repositories/someorg/doc-test.git: signal: killed
2024/07/30 07:52:36 modules/git/diff.go:313:GetAffectedFiles() [E] Unable to get affected files for commits from 0000000000000000000000000000000000000000 to f28e63b56d8d5dfedca6e59167f1d32d3f15186c in /data/git/repositories/someorg/doc-test.git: exit status 128
2024/07/30 07:52:36 .../hook_pre_receive.go:235:preReceiveBranch() [E] Unable to check file protection for commits from 0000000000000000000000000000000000000000 to f28e63b56d8d5dfedca6e59167f1d32d3f15186c in <Repository 331:someorg/doc-test>: exit status 128
2024/07/30 07:52:36 ...s/private/ssh_log.go:26:SSHLog() [E] ssh: Internal Server Error (no message for end users) HookPreReceive(last) failed: internal API error response, status=500, err=Unable to check file protection for commits from 0000000000000000000000000000000000000000 to f28e63b56d8d5dfedca6e59167f1d32d3f15186c: exit status 128
Gitea Version
1.21.11
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
Docker, but it can be reproduced on demo.gitea.com
Database
MySQL/MariaDB