-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent update pull refs manually and will not affect other refs update #31931
Conversation
If a repository contains open pull requests, executing |
There are other ref "types", eg: Ideally, I think the
|
I need to clarify there are two kinds of skips here. One is just executed and don't return error. another is don't execute it and don't return error. |
ps: just realized that this logic is in "pre-receive" hook , no idea whether it is possible to only skip some branches. If it is impossible to skip, then maybe the only choice is to "stop the loop" (just like what the PR did in the first commit). |
I think now it should resolve your problem. Although you will get some errors but that will not affect other refs update. Currently I don't know how to let git ignore those error informations. |
I changed it to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest add some test code.
Tests added. |
…te (go-gitea#31931) 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.
…te (#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 <[email protected]>
* giteaofficial/main: [skip ci] Updated translations via Crowdin [skip ci] Updated translations via Crowdin Remove html tags from create tag and branch translation (go-gitea#31973) Replace v-html with v-text in search inputbox (go-gitea#31966) [skip ci] Updated translations via Crowdin [skip ci] Updated translations via Crowdin Improve get feed with pagination (go-gitea#31821) Remove urls from translations (go-gitea#31950) Prevent update pull refs manually and will not affect other refs update (go-gitea#31931) [skip ci] Updated translations via Crowdin nix wording nit in todo code comment Fix 500 error when `state` params is set when editing issue/PR by API (go-gitea#31880) Fix sort order for organization home and user profile page (go-gitea#31921) Improve textarea paste (go-gitea#31948) Fix index too many file names bug (go-gitea#31903) [skip ci] Updated translations via Crowdin Move web globals to `web_src/js/globals.d.ts` (go-gitea#31943)
- This a port of go-gitea/gitea#31931 in a behavior-sense. None of the code was actually ported. - Follow up for #2834, now also don't allow modification. - Integration test added. - Unit test modified.
Please fire a new issue to report it. |
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 notpre-receive
becauseupdate
will be invoked by every ref butpre-receive
will revert all changes once one ref update fails.