diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-10-22 14:18:45 +0100 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-10-25 11:23:34 +0100 |
commit | f8ee07d9ee6d01b255902ad976a07beef59a95fb (patch) | |
tree | b72f437ffe28b36d99fe2b24713127ad27f191e3 /app/workers/post_receive.rb | |
parent | f5d71ad8f3d1899a29bc12c4fcc8847b14195e3a (diff) | |
download | gitlab-ce-f8ee07d9ee6d01b255902ad976a07beef59a95fb.tar.gz |
User not defined in PostReceive#process_project_changes
When Gitlab::GitPostReceive#changes_refs is empty
user would not get defined and nil would be passed
to PostReceive#after_project_changes_hooks which would
then throw an error.
Diffstat (limited to 'app/workers/post_receive.rb')
-rw-r--r-- | app/workers/post_receive.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb index 09a594cdb4e..207eef6229f 100644 --- a/app/workers/post_receive.rb +++ b/app/workers/post_receive.rb @@ -29,14 +29,11 @@ class PostReceive def process_project_changes(post_received) changes = [] refs = Set.new + @user = post_received.identify post_received.changes_refs do |oldrev, newrev, ref| @user ||= post_received.identify(newrev) - - unless @user - log("Triggered hook for non-existing user \"#{post_received.identifier}\"") - return false # rubocop:disable Cop/AvoidReturnFromBlocks - end + break unless @user if Gitlab::Git.tag_ref?(ref) GitTagPushService.new(post_received.project, @user, oldrev: oldrev, newrev: newrev, ref: ref).execute @@ -48,6 +45,11 @@ class PostReceive refs << ref end + unless @user + log("Triggered hook for non-existing user \"#{post_received.identifier}\"") + return false + end + after_project_changes_hooks(post_received, @user, refs.to_a, changes) end |