Added specs for special cases

We don't execute web hooks when:
 * You create a new branch. Make sure you first create the branch, and then push any commits. This is the way Github works, so its expected behavior.
 * When tags are pushed.
This commit is contained in:
Ariejan de Vroom 2011-12-15 10:33:20 +01:00
parent edab46e9fa
commit 7ffb8fc616
2 changed files with 27 additions and 1 deletions

View file

@ -92,6 +92,11 @@ class Project < ActiveRecord::Base
end
def execute_web_hooks(oldrev, newrev, ref)
ref_parts = ref.split('/')
# Return if this is not a push to a branch (e.g. new commits)
return if ref_parts[1] !~ /heads/ || oldrev == "00000000000000000000000000000000"
data = web_hook_data(oldrev, newrev, ref)
web_hooks.each { |web_hook| web_hook.execute(data) }
end