Skip to content

Commit 4603e57

Browse files
committed
Fix duplicated branch creation/deletion Web hooks/service notifications when using Web UI
Similar to 423d2d6, except duplicates occurred only if a Web service (e.g. Slack) were configured. When deleting a branch, this is what was happening: 1. DeleteBranchService calls execute_hooks and execute_services 2. The call to repository.rm_branch triggers the GitHooksService. 3. This, in turn, calls GitPushService and then calls the same hooks/services again. 5145706 now makes it no longer necessary for DeleteBranchService and CreateBranchService to execute the branch hooks/services. Note that tags behave differently in GitTagPushService and GitPushService is not called. Closes gitlabhq#10330
1 parent 706b101 commit 4603e57

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

CHANGELOG

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
22

33
v 8.5.0 (unreleased)
44
- Cache various Repository methods to improve performance (Yorick Peterse)
5+
- Fix duplicated branch creation/deletion Web hooks/service notifications when using Web UI (Stan Hu)
56
- Ensure rake tasks that don't need a DB connection can be run without one
67
- Update New Relic gem to 3.14.1.311 (Stan Hu)
78
- Add "visibility" flag to GET /projects api endpoint

app/services/create_branch_service.rb

+1-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ def execute(branch_name, ref, source_project: @project)
2929
end
3030

3131
if new_branch
32-
push_data = build_push_data(project, current_user, new_branch)
33-
34-
project.execute_hooks(push_data.dup, :push_hooks)
35-
project.execute_services(push_data.dup, :push_hooks)
36-
32+
# GitPushService handles execution of services and hooks for branch pushes
3733
success(new_branch)
3834
else
3935
error('Invalid reference name')

app/services/delete_branch_service.rb

+1-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ def execute(branch_name)
2525
end
2626

2727
if repository.rm_branch(current_user, branch_name)
28-
push_data = build_push_data(branch)
29-
30-
project.execute_hooks(push_data.dup, :push_hooks)
31-
project.execute_services(push_data.dup, :push_hooks)
32-
28+
# GitPushService handles execution of services and hooks for branch pushes
3329
success('Branch was removed')
3430
else
3531
error('Failed to remove branch')

0 commit comments

Comments
 (0)