Commit 0a4c907c authored by Douwe Maan's avatar Douwe Maan

Remove oldrev and newrev nil-checks that are now unnecessary

parent c61cb3b4
......@@ -9,7 +9,7 @@ module EE
LOG_MESSAGE = "Checking if branch follows the naming patterns defined by the project...".freeze
def validate!
return unless newrev && oldrev && push_rule
return unless push_rule
logger.log_timed(LOG_MESSAGE) do
unless branch_name_allowed_by_push_rule?
......
......@@ -13,7 +13,7 @@ module EE
LOG_MESSAGE = "Checking if commits follow defined push rules...".freeze
def validate!
return unless newrev && oldrev && push_rule
return unless push_rule
commit_validation = push_rule.commit_validation?
# if newrev is blank, the branch was deleted
......
......@@ -6,7 +6,7 @@ module EE
module PushRules
class TagCheck < ::Gitlab::Checks::BaseChecker
def validate!
return unless newrev && oldrev && push_rule
return unless push_rule
logger.log_timed("Checking if you are allowed to delete a tag...") do
if tag_deletion_denied_by_push_rule?
......
......@@ -19,12 +19,16 @@ module Gitlab
private
def creation?
Gitlab::Git.blank_ref?(oldrev)
end
def deletion?
Gitlab::Git.blank_ref?(newrev)
end
def update?
!Gitlab::Git.blank_ref?(oldrev) && !deletion?
!creation? && !deletion?
end
def updated_from_web?
......
......@@ -12,7 +12,7 @@ module Gitlab
}.freeze
def validate!
return if deletion? || newrev.nil?
return if deletion?
return unless should_run_diff_validations?
return if commits.empty?
......
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