'Delete merged branches' invokes server hooks per branch
<!--IssueSummary start-->
<details>
<summary>
Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards.
</summary>
- [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=420795)
</details>
<!--IssueSummary end-->
### Summary
When using [the 'Delete merged branches' functionality][docs], server hooks are invoked once per branch deleted. This is not only a performance issue, but if the hooks have side-effects (like sending an email), those side-effects are repeated for each branch instead of being batched together appropriately.
[docs]: https://docs.gitlab.com/ee/user/project/repository/branches/#delete-merged-branches
### Steps to reproduce
1. Configure a pre-receive hook on a new project. For each branch in a push, perform some side-effect (post some logs, send an email, etc).
2. Create some number of branches directly on the mainline.
3. Use the 'Delete merged branches' functionality as described in [the docs][docs].
### Example Project
```sh
git init
git commit --allow-empty -m "Initial commit"
git push origin main:refs/heads/main
seq 1 10 | xargs -L1 -I% echo git push origin main:refs/heads/branch-%
```
### What is the current *bug* behavior?
The pre-receive hook is invoked more than once with input of the form
```
deadbeef 0000000 refs/heads/branch-%
```
### What is the expected *correct* behavior?
The pre-receive hook is invoked exactly once with input of the form
```
deadbeef 0000000 refs/heads/branch-1
deadbeef 0000000 refs/heads/branch-2
deadbeef 0000000 refs/heads/branch-3
...
```
### Relevant logs and/or screenshots
None available.
### Output of checks
(Checking with the folks that maintain our gitlab instance for this section and below.)
#### Results of GitLab environment info
<details>
<summary>Expand for output related to GitLab environment info</summary>
<pre>
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)
(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
</pre>
</details>
#### Results of GitLab application Check
<!-- Input any relevant GitLab application check information if needed. -->
<details>
<summary>Expand for output related to the GitLab application check</summary>
<pre>
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:check SANITIZE=true`)
(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`)
(we will only investigate if the tests are passing)
</pre>
</details>
issue