[go: up one dir, main page]

Skip to content

'Delete merged branches' invokes server hooks per branch

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When using the 'Delete merged branches' functionality, 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.

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.

Example Project

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

Expand for output related to GitLab environment info

(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`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(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)

Edited by 🤖 GitLab Bot 🤖