2018-12-13 13:39:08 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
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
|
2018-03-17 18:26:18 +05:30
|
|
|
return false if Gitlab::Git.blank_ref?(oldrev) || Gitlab::Git.blank_ref?(newrev)
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
!project
|
|
|
|
.repository
|
|
|
|
.gitaly_commit_client
|
|
|
|
.ancestor?(oldrev, newrev)
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|