diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-14 16:00:02 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-14 16:00:02 +0400 |
commit | b698094d4dcd1558bfcc1611d3572297dd11ae1e (patch) | |
tree | 2be71177fb83cce5f67df1683d56d9f7b3737a03 /app | |
parent | ed3f44085e01f50864ce840f007a50d2154df6f5 (diff) |
Update post-receive worker to use correct identifier
Diffstat (limited to 'app')
-rw-r--r-- | app/workers/post_receive.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb index e3f62d736ef..3ef6d5977cf 100644 --- a/app/workers/post_receive.rb +++ b/app/workers/post_receive.rb @@ -21,14 +21,18 @@ class PostReceive return false end - # Ignore push from non-gitlab users - user = if identifier.nil? - raise identifier.inspect + user = if identifier.blank? + # Local push from gitlab email = project.repository.commit(newrev).author.email rescue nil User.find_by_email(email) if email - elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier) - User.find_by_email(identifier) - elsif identifier =~ /key/ + + elsif identifier =~ /\Auser-\d+\Z/ + # git push over http + user_id = identifier.gsub("user-", "") + User.find_by_id(user_id) + + elsif identifier =~ /\Akey-\d+\Z/ + # git push over ssh key_id = identifier.gsub("key-", "") Key.find_by_id(key_id).try(:user) end |