summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-10-26 18:06:25 +0000
committerDouwe Maan <douwe@gitlab.com>2018-10-26 18:06:25 +0000
commite997b22df50a46759cac9936a6557993310f8888 (patch)
tree7477ee5da963ef699652ccc84fc4fee8726babad /lib
parentf2e9148d18c049bb699e60ed31d3804f9ae4b592 (diff)
parent679d9b21b7aac55796ef59d5694b7d2e0fb40b35 (diff)
downloadgitlab-ce-e997b22df50a46759cac9936a6557993310f8888.tar.gz
Merge branch '51335-fail-early-when-user-cannot-be-identified' into 'master'
User not defined in PostReceive#process_project_changes Closes #51335 See merge request gitlab-org/gitlab-ce!22519
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git_post_receive.rb4
-rw-r--r--lib/gitlab/identifier.rb21
2 files changed, 5 insertions, 20 deletions
diff --git a/lib/gitlab/git_post_receive.rb b/lib/gitlab/git_post_receive.rb
index e731e654f3c..cf2329e489d 100644
--- a/lib/gitlab/git_post_receive.rb
+++ b/lib/gitlab/git_post_receive.rb
@@ -11,8 +11,8 @@ module Gitlab
@changes = deserialize_changes(changes)
end
- def identify(revision)
- super(identifier, project, revision)
+ def identify
+ super(identifier)
end
def changes_refs
diff --git a/lib/gitlab/identifier.rb b/lib/gitlab/identifier.rb
index 28a9fe29465..d5f94ad04f1 100644
--- a/lib/gitlab/identifier.rb
+++ b/lib/gitlab/identifier.rb
@@ -1,13 +1,11 @@
# frozen_string_literal: true
# Detect user based on identifier like
-# key-13 or user-36 or last commit
+# key-13 or user-36
module Gitlab
module Identifier
- def identify(identifier, project = nil, newrev = nil)
- if identifier.blank?
- identify_using_commit(project, newrev)
- elsif identifier =~ /\Auser-\d+\Z/
+ def identify(identifier)
+ if identifier =~ /\Auser-\d+\Z/
# git push over http
identify_using_user(identifier)
elsif identifier =~ /\Akey-\d+\Z/
@@ -16,19 +14,6 @@ module Gitlab
end
end
- # Tries to identify a user based on a commit SHA.
- def identify_using_commit(project, ref)
- return if project.nil? && ref.nil?
-
- commit = project.commit(ref)
-
- return if !commit || !commit.author_email
-
- identify_with_cache(:email, commit.author_email) do
- commit.author
- end
- end
-
# Tries to identify a user based on a user identifier (e.g. "user-123").
# rubocop: disable CodeReuse/ActiveRecord
def identify_using_user(identifier)