Commit 730712f7 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Update post-receive worker for new format

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 0306a4e2
...@@ -4,8 +4,7 @@ class PostReceive ...@@ -4,8 +4,7 @@ class PostReceive
sidekiq_options queue: :post_receive 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) if repo_path.start_with?(Gitlab.config.gitlab_shell.repos_path.to_s)
repo_path.gsub!(Gitlab.config.gitlab_shell.repos_path.to_s, "") repo_path.gsub!(Gitlab.config.gitlab_shell.repos_path.to_s, "")
else else
...@@ -22,17 +21,23 @@ class PostReceive ...@@ -22,17 +21,23 @@ class PostReceive
return false return false
end end
user = identify(identifier, project, newrev) changes = changes.lines if changes.kind_of?(String)
changes.each do |change|
oldrev, newrev, ref = change.strip.split(' ')
unless user @user ||= identify(identifier, project, newrev)
unless @user
log("Triggered hook for non-existing user \"#{identifier} \"") log("Triggered hook for non-existing user \"#{identifier} \"")
return false return false
end end
if tag?(ref) if tag?(ref)
GitTagPushService.new.execute(project, user, oldrev, newrev, ref) GitTagPushService.new.execute(project, @user, oldrev, newrev, ref)
else else
GitPushService.new.execute(project, user, oldrev, newrev, ref) GitPushService.new.execute(project, @user, oldrev, newrev, ref)
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment