Welcome to mirror list, hosted at ThFree Co, Russian Federation.

force_push.rb « checks « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1e73f89158dc816599f132d34cc73a5a80fa29dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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