-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Gitea makes update hooks but doesn't use them #9495
Comments
I'm gonna reopen this because #9496 doesn't actually remove these hooks anymore. |
OKay. I think it's clear as @lafriks said #9496 (comment).
Currently, we just need to use |
Almost everything that can be done in an update hook can be done at pre-receive - the only things being different are that pre-receive cannot make references whereas it appears that update can. Despite its name pre-receive is called after the packs have been received and are present on the server in the quarantine directory. Update hooks have to run once per received reference this makes them a rather expensive hook especially for migrations where many references could be updated at once. Therefore apart from that slight difference which could easily be done at post-receive I do not believe that there could ever be a reason for having a gitea update hook and therefore I believe we should simply remove it. I would even go further and state that we should not support update hooks. Their only power above that of pre-receive is to do something that would lead to gitea not knowing about branches in its own repository. |
For reference looking at the Git source code: You'd think that pre-receive is run before the packs are uploaded... but that's not what the documentation implies nor what this code does, take a look at pre-receive is called at The packs are received at: which is in the function that calls |
@zeripath see the comments on https://github.com/git/git/blob/0a76bd7381ec0dbb7c43776eb6d1ac906bca29e6/builtin/receive-pack.c#L1506-L1517 . The packs uploaded on temp directory before pre-received hook. |
Yes. The directories are specified as GIT_QUARANTINE_PATH. All of the objects are on the server already and can be queried with an appropriate look up in the quarantine dir and the alternative dir as appropriate. We do this already in the pre-receive hook: Lines 65 to 78 in 145c1ea
We will never need a update hook. |
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions. |
This issue has been automatically closed because of inactivity. You can re-open it if needed. |
Description
gitea/models/repo.go
Line 979 in 3e166bd
creates update hooks however gitea does not use this hook and the equivalent hook is essentially empty except for reading the settings file.
This would be of little consequence, except update is run for every reference and this means the settings are read for every reference! This means that pushes that involve a large number of references are unnecessarily slowed.
The text was updated successfully, but these errors were encountered: