diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2017-08-09 08:36:24 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2017-08-11 19:42:17 +0200 |
commit | daa0137b41eeec4008e8292971601fc8594b5329 (patch) | |
tree | 58987f0d4bb22efdf1027c870bf4980693f22829 /lib/gitlab/checks | |
parent | 8d2099cd8ab02209a0c7aeccc43ecba57a07ae2a (diff) | |
download | gitlab-ce-daa0137b41eeec4008e8292971601fc8594b5329.tar.gz |
Migrate force push check to Gitalyfeature/migrate-force-push-check-to-gitaly
Diffstat (limited to 'lib/gitlab/checks')
-rw-r--r-- | lib/gitlab/checks/force_push.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/gitlab/checks/force_push.rb b/lib/gitlab/checks/force_push.rb index 1e73f89158d..714464fd5e7 100644 --- a/lib/gitlab/checks/force_push.rb +++ b/lib/gitlab/checks/force_push.rb @@ -5,12 +5,19 @@ module Gitlab 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? + return false if Gitlab::Git.blank_ref?(oldrev) || Gitlab::Git.blank_ref?(newrev) + + GitalyClient.migrate(:force_push) do |is_enabled| + if is_enabled + !project + .repository + .gitaly_commit_client + .is_ancestor(oldrev, newrev) + else + Gitlab::Git::RevList.new( + path_to_repo: project.repository.path_to_repo, + oldrev: oldrev, newrev: newrev).missed_ref.present? + end end end end |