BigW Consortium Gitlab

force_push.rb 487 Bytes
Newer Older
1 2 3
module Gitlab
  module Checks
    class ForcePush
4
      def self.force_push?(project, oldrev, newrev)
5 6 7 8 9 10
        return false if project.empty_repo?

        # Created or deleted branch
        if Gitlab::Git.blank_ref?(oldrev) || Gitlab::Git.blank_ref?(newrev)
          false
        else
11 12 13
          Gitlab::Git::RevList.new(
            path_to_repo: project.repository.path_to_repo,
            oldrev: oldrev, newrev: newrev).missed_ref.present?
14 15 16 17 18
        end
      end
    end
  end
end