summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/workers/post_receive.rb27
1 files changed, 16 insertions, 11 deletions
diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb
index f110e20bf00..1406cba2db3 100644
--- a/app/workers/post_receive.rb
+++ b/app/workers/post_receive.rb
@@ -4,8 +4,7 @@ class PostReceive
sidekiq_options queue: :post_receive
- def perform(repo_path, oldrev, newrev, ref, identifier)
-
+ def perform(repo_path, identifier, changes)
if repo_path.start_with?(Gitlab.config.gitlab_shell.repos_path.to_s)
repo_path.gsub!(Gitlab.config.gitlab_shell.repos_path.to_s, "")
else
@@ -22,17 +21,23 @@ class PostReceive
return false
end
- user = identify(identifier, project, newrev)
+ changes = changes.lines if changes.kind_of?(String)
- unless user
- log("Triggered hook for non-existing user \"#{identifier} \"")
- return false
- end
+ changes.each do |change|
+ oldrev, newrev, ref = change.strip.split(' ')
- if tag?(ref)
- GitTagPushService.new.execute(project, user, oldrev, newrev, ref)
- else
- GitPushService.new.execute(project, user, oldrev, newrev, ref)
+ @user ||= identify(identifier, project, newrev)
+
+ unless @user
+ log("Triggered hook for non-existing user \"#{identifier} \"")
+ return false
+ end
+
+ if tag?(ref)
+ GitTagPushService.new.execute(project, @user, oldrev, newrev, ref)
+ else
+ GitPushService.new.execute(project, @user, oldrev, newrev, ref)
+ end
end
end