Commit 79f0858a18081d37669883f1b5a32d033197561d

Authored by Dmitriy Zaporozhets
1 parent c2f10400

Services and hooks MUST BE executed on branch push!

Showing 1 changed file with 7 additions and 0 deletions   Show diff stats
app/services/git_push_service.rb
@@ -30,6 +30,9 @@ class GitPushService @@ -30,6 +30,9 @@ class GitPushService
30 if push_to_existing_branch?(ref, oldrev) 30 if push_to_existing_branch?(ref, oldrev)
31 project.update_merge_requests(oldrev, newrev, ref, @user) 31 project.update_merge_requests(oldrev, newrev, ref, @user)
32 process_commit_messages(ref) 32 process_commit_messages(ref)
  33 + end
  34 +
  35 + if push_to_branch?(ref)
33 project.execute_hooks(@push_data.dup) 36 project.execute_hooks(@push_data.dup)
34 project.execute_services(@push_data.dup) 37 project.execute_services(@push_data.dup)
35 end 38 end
@@ -175,6 +178,10 @@ class GitPushService @@ -175,6 +178,10 @@ class GitPushService
175 ref_parts[1] =~ /heads/ && oldrev == "0000000000000000000000000000000000000000" 178 ref_parts[1] =~ /heads/ && oldrev == "0000000000000000000000000000000000000000"
176 end 179 end
177 180
  181 + def push_to_branch? ref
  182 + ref =~ /refs\/heads/
  183 + end
  184 +
178 def is_default_branch? ref 185 def is_default_branch? ref
179 ref == "refs/heads/#{project.default_branch}" 186 ref == "refs/heads/#{project.default_branch}"
180 end 187 end