From 79f0858a18081d37669883f1b5a32d033197561d Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 27 Aug 2013 13:56:04 +0300 Subject: [PATCH] Services and hooks MUST BE executed on branch push! --- app/services/git_push_service.rb | 7 +++++++ 1 file changed, 7 insertions(+), 0 deletions(-) diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index e774b22..9584f42 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -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 -- libgit2 0.21.2