debian-mirror-gitlab/lib/gitlab/checks/force_push.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
440 B
Ruby
Raw Normal View History

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