OSDN Git Service

Services and hooks MUST BE executed on branch push!
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Tue, 27 Aug 2013 10:56:04 +0000 (13:56 +0300)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Tue, 27 Aug 2013 10:56:04 +0000 (13:56 +0300)
app/services/git_push_service.rb

index e774b22..9584f42 100644 (file)
@@ -30,6 +30,9 @@ class GitPushService
     if push_to_existing_branch?(ref, oldrev)
       project.update_merge_requests(oldrev, newrev, ref, @user)
       process_commit_messages(ref)
+    end
+
+    if push_to_branch?(ref)
       project.execute_hooks(@push_data.dup)
       project.execute_services(@push_data.dup)
     end
@@ -175,6 +178,10 @@ class GitPushService
     ref_parts[1] =~ /heads/ && oldrev == "0000000000000000000000000000000000000000"
   end
 
+  def push_to_branch? ref
+    ref =~ /refs\/heads/
+  end
+
   def is_default_branch? ref
     ref == "refs/heads/#{project.default_branch}"
   end