gitlab-org--gitlab-foss/lib/gitlab/checks/force_push.rb
Rémy Coutable 3de11e1a00 Don't pass env anymore to GitAccess, ChangeAccess, and ForcePush
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-04-10 16:10:18 +02:00

18 lines
487 B
Ruby

module Gitlab
module Checks
class ForcePush
def self.force_push?(project, oldrev, newrev)
return false if project.empty_repo?
# Created or deleted branch
if Gitlab::Git.blank_ref?(oldrev) || Gitlab::Git.blank_ref?(newrev)
false
else
Gitlab::Git::RevList.new(
path_to_repo: project.repository.path_to_repo,
oldrev: oldrev, newrev: newrev).missed_ref.present?
end
end
end
end
end