debian-mirror-gitlab/lib/gitlab/checks/force_push.rb

19 lines
487 B
Ruby
Raw Normal View History

2016-08-24 12:49:21 +05:30
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
2017-08-17 22:00:37 +05:30
Gitlab::Git::RevList.new(
path_to_repo: project.repository.path_to_repo,
oldrev: oldrev, newrev: newrev).missed_ref.present?
2016-08-24 12:49:21 +05:30
end
end
end
end
end