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