diff options
author | Nick Thomas <nick@gitlab.com> | 2018-07-31 14:07:24 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-07-31 14:07:24 +0000 |
commit | 2fe57a4108ea0aa123bb94f73012aa4c7edde944 (patch) | |
tree | 041b9ee2e1ee02e3fe0df3239a8b2d81184aa5cf /lib | |
parent | 7eba85371765418044ed0caabb1a761e9cb9e597 (diff) | |
parent | 8402d67aab78ca939286bd281ce24bd5fc7e462e (diff) | |
download | gitlab-ce-2fe57a4108ea0aa123bb94f73012aa4c7edde944.tar.gz |
Merge branch 'fj-37736-improve-performance-post-receive-cleaning-code' into 'master'
Code cleaning in PostReceive services
See merge request gitlab-org/gitlab-ce!20916
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git_post_receive.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/gitlab/git_post_receive.rb b/lib/gitlab/git_post_receive.rb index 742118b76a8..e731e654f3c 100644 --- a/lib/gitlab/git_post_receive.rb +++ b/lib/gitlab/git_post_receive.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab class GitPostReceive include Gitlab::Identifier @@ -14,10 +16,11 @@ module Gitlab end def changes_refs - return enum_for(:changes_refs) unless block_given? + return changes unless block_given? changes.each do |change| - oldrev, newrev, ref = change.strip.split(' ') + change.strip! + oldrev, newrev, ref = change.split(' ') yield oldrev, newrev, ref end @@ -26,13 +29,10 @@ module Gitlab private def deserialize_changes(changes) - changes = utf8_encode_changes(changes) - changes.lines + utf8_encode_changes(changes).each_line end def utf8_encode_changes(changes) - changes = changes.dup - changes.force_encoding('UTF-8') return changes if changes.valid_encoding? |