]> source.dussan.org Git - gitea.git/commit
Prevent update pull refs manually and will not affect other refs update (#31931)...
authorGiteabot <teabot@gitea.io>
Mon, 2 Sep 2024 10:28:00 +0000 (18:28 +0800)
committerGitHub <noreply@github.com>
Mon, 2 Sep 2024 10:28:00 +0000 (18:28 +0800)
commit6f5748c50752e4b1f99d532a34a57bd773e466b8
tree0604a3d28d03223f834b422e7b2e3d79f433a562
parentcc1520221a9689b4725b0e8668ce58f95e787130
Prevent update pull refs manually and will not affect other refs update (#31931) (#31955)

Backport #31931 by @lunny

All refs under `refs/pull` should only be changed from Gitea inside but
not by pushing from outside of Gitea.
This PR will prevent the pull refs update but allow other refs to be
updated on the same pushing with `--mirror` operations.

The main changes are to add checks on `update` hook but not
`pre-receive` because `update` will be invoked by every ref but
`pre-receive` will revert all changes once one ref update fails.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
cmd/hook.go
tests/integration/git_push_test.go
tests/test_utils.go