2016-07-18 04:16:56 -04:00
|
|
|
module Gitlab
|
|
|
|
module Checks
|
|
|
|
class ForcePush
|
2017-04-05 03:35:58 -04:00
|
|
|
def self.force_push?(project, oldrev, newrev)
|
2016-07-18 04:16:56 -04:00
|
|
|
return false if project.empty_repo?
|
|
|
|
|
|
|
|
# Created or deleted branch
|
2017-08-09 02:36:24 -04:00
|
|
|
return false if Gitlab::Git.blank_ref?(oldrev) || Gitlab::Git.blank_ref?(newrev)
|
|
|
|
|
2018-06-19 09:01:36 -04:00
|
|
|
!project
|
|
|
|
.repository
|
|
|
|
.gitaly_commit_client
|
|
|
|
.ancestor?(oldrev, newrev)
|
2016-07-18 04:16:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|