PostReceive: Don't generate push_data unless necessary
From https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31641#note_202201578, for each tag or branch pushed, it looks like we request a CommitDelta
to generate the push data. From BaseHooksService
, we run:
def execute_project_hooks
project.execute_hooks(push_data, hook_name)
project.execute_services(push_data, hook_name)
end
Project#execute_hooks
will run for both project-specific hooks and system hooks. We could avoid all this work by optimizing this so that:
- Only execute hooks if there are any relevant hooks
- Only execute services if there are any relevant services