summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorDuana Saskia <starkcoffee@users.noreply.github.com>2018-06-07 09:35:17 +0200
committerDuana Saskia <starkcoffee@users.noreply.github.com>2018-08-13 13:20:58 +0200
commitece6a1ea6ecffdbde5ff7d663f1ad1eb74f78aa6 (patch)
tree288e34ff932b6c84e1a1c5ead26cbd8f80ea12f5 /app/models/project.rb
parent07356866b2ce85f4d724c96f14e129fbe6a56963 (diff)
downloadgitlab-ce-ece6a1ea6ecffdbde5ff7d663f1ad1eb74f78aa6.tar.gz
Filter project hooks by branch
Allow specificying a branch filter for a project hook and only trigger a project hook if either the branch filter is blank or the branch matches. Only supported for push_events for now.
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 7735f23cb9e..72a53e1a50d 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1163,10 +1163,9 @@ class Project < ActiveRecord::Base
def execute_hooks(data, hooks_scope = :push_hooks)
run_after_commit_or_now do
- hooks.hooks_for(hooks_scope).each do |hook|
+ hooks.hooks_for(hooks_scope).select {|hook| ActiveHookFilter.new(hook).matches?(hooks_scope, data)}.each do |hook|
hook.async_execute(data, hooks_scope.to_s)
end
-
SystemHooksService.new.execute_hooks(data, hooks_scope)
end
end