force_push_check.rb 431 字节
Newer Older
1 2 3 4 5 6
module Gitlab
  class ForcePushCheck
    def self.force_push?(project, oldrev, newrev)
      return false if project.empty_repo?

      if oldrev != Gitlab::Git::BLANK_SHA && newrev != Gitlab::Git::BLANK_SHA
7
        missed_refs, _ = Gitlab::Popen.popen(%W(git --git-dir=#{project.repository.path_to_repo} rev-list #{oldrev} ^#{newrev}))
8 9 10 11 12 13 14
        missed_refs.split("\n").size > 0
      else
        false
      end
    end
  end
end