diff options
author | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2018-07-30 20:16:57 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2018-07-30 20:16:57 +0300 |
commit | 1edc945c27e9368a2e73565d70fdf827ab7274c6 (patch) | |
tree | e8855b935b0fd20187769f749fb1e2198e3ebfea | |
parent | 366f364ce4cdbbd3eaa9314447f64deb6e5fb889 (diff) | |
parent | 053954513ab6533e1a9e2a0c268ca92512281091 (diff) |
Merge branch 'zj-vendor-gitlab-git-20180730' into 'master'
Vendor Gitlab::Git at 2ca8219a20f16
See merge request gitlab-org/gitaly!841
-rw-r--r-- | changelogs/unreleased/zj-vendor-gitlab-git-20180730.yml | 5 | ||||
-rw-r--r-- | ruby/lib/gitlab/gitaly_client.rb | 6 | ||||
-rw-r--r-- | ruby/vendor/gitlab_git/REVISION | 2 | ||||
-rw-r--r-- | ruby/vendor/gitlab_git/lib/gitlab/git/repository.rb | 40 | ||||
-rw-r--r-- | ruby/vendor/gitlab_git/lib/gitlab/git/repository_mirroring.rb | 4 |
5 files changed, 27 insertions, 30 deletions
diff --git a/changelogs/unreleased/zj-vendor-gitlab-git-20180730.yml b/changelogs/unreleased/zj-vendor-gitlab-git-20180730.yml new file mode 100644 index 000000000..408ec3e50 --- /dev/null +++ b/changelogs/unreleased/zj-vendor-gitlab-git-20180730.yml @@ -0,0 +1,5 @@ +--- +title: Vendor Gitlab::Git at 2ca8219a20f16 +merge_request: 841 +author: +type: other diff --git a/ruby/lib/gitlab/gitaly_client.rb b/ruby/lib/gitlab/gitaly_client.rb index e6b45c9aa..fd1f7cf23 100644 --- a/ruby/lib/gitlab/gitaly_client.rb +++ b/ruby/lib/gitlab/gitaly_client.rb @@ -6,6 +6,12 @@ module Gitlab OPT_OUT = :fake_opt_out end + class StorageSettings + def self.allow_disk_access + yield + end + end + class << self # In case we hit a method that tries to do a Gitaly RPC, we want to # prevent this most of the time. diff --git a/ruby/vendor/gitlab_git/REVISION b/ruby/vendor/gitlab_git/REVISION index cccb4ae43..48e55c453 100644 --- a/ruby/vendor/gitlab_git/REVISION +++ b/ruby/vendor/gitlab_git/REVISION @@ -1 +1 @@ -92802e51075f485ce2aa80d19f40688f1dd95fb7 +2ca8219a20f16636b7a0ffa899a1a04ab8e84782 diff --git a/ruby/vendor/gitlab_git/lib/gitlab/git/repository.rb b/ruby/vendor/gitlab_git/lib/gitlab/git/repository.rb index 21ac43f80..eb02c7ac8 100644 --- a/ruby/vendor/gitlab_git/lib/gitlab/git/repository.rb +++ b/ruby/vendor/gitlab_git/lib/gitlab/git/repository.rb @@ -353,8 +353,6 @@ module Gitlab # offset: 5, # after: Time.new(2016, 4, 21, 14, 32, 10) # ) - # - # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/446 def log(options) default_options = { limit: 10, @@ -560,7 +558,9 @@ module Gitlab if is_enabled gitaly_operation_client.user_update_branch(branch_name, user, newrev, oldrev) else - OperationService.new(user, self).update_branch(branch_name, newrev, oldrev) + Gitlab::GitalyClient::StorageSettings.allow_disk_access do + OperationService.new(user, self).update_branch(branch_name, newrev, oldrev) + end end end end @@ -826,22 +826,17 @@ module Gitlab end end + # This method, fetch_ref, is used from within + # Gitlab::Git::OperationService. OperationService will eventually only + # exist in gitaly-ruby. When we delete OperationService from gitlab-ce + # we can also remove fetch_ref. def fetch_ref(source_repository, source_ref:, target_ref:) Gitlab::Git.check_namespace!(source_repository) source_repository = RemoteRepository.new(source_repository) unless source_repository.is_a?(RemoteRepository) - message, status = GitalyClient.migrate(:fetch_ref) do |is_enabled| - if is_enabled - gitaly_fetch_ref(source_repository, source_ref: source_ref, target_ref: target_ref) - else - # When removing this code, also remove source_repository#path - # to remove deprecated method calls - local_fetch_ref(source_repository.path, source_ref: source_ref, target_ref: target_ref) - end - end - - # Make sure ref was created, and raise Rugged::ReferenceError when not - raise Rugged::ReferenceError, message if status != 0 + args = %W(fetch --no-tags -f #{GITALY_INTERNAL_URL} #{source_ref}:#{target_ref}) + message, status = run_git(args, env: source_repository.fetch_env) + raise Gitlab::Git::CommandError, message if status != 0 target_ref end @@ -1025,8 +1020,8 @@ module Gitlab end def clean_stale_repository_files - gitaly_migrate(:repository_cleanup, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled| - gitaly_repository_client.cleanup if is_enabled && exists? + wrapped_gitaly_errors do + gitaly_repository_client.cleanup if exists? end rescue Gitlab::Git::CommandError => e # Don't fail if we can't cleanup Rails.logger.error("Unable to clean repository on storage #{storage} with relative path #{relative_path}: #{e.message}") @@ -1242,17 +1237,6 @@ module Gitlab gitaly_repository_client.apply_gitattributes(revision) end - def local_fetch_ref(source_path, source_ref:, target_ref:) - args = %W(fetch --no-tags -f #{source_path} #{source_ref}:#{target_ref}) - run_git(args) - end - - def gitaly_fetch_ref(source_repository, source_ref:, target_ref:) - args = %W(fetch --no-tags -f #{GITALY_INTERNAL_URL} #{source_ref}:#{target_ref}) - - run_git(args, env: source_repository.fetch_env) - end - def gitaly_delete_refs(*ref_names) gitaly_ref_client.delete_refs(refs: ref_names) if ref_names.any? end diff --git a/ruby/vendor/gitlab_git/lib/gitlab/git/repository_mirroring.rb b/ruby/vendor/gitlab_git/lib/gitlab/git/repository_mirroring.rb index 8835bfb24..65eb5cc18 100644 --- a/ruby/vendor/gitlab_git/lib/gitlab/git/repository_mirroring.rb +++ b/ruby/vendor/gitlab_git/lib/gitlab/git/repository_mirroring.rb @@ -6,7 +6,9 @@ module Gitlab if is_enabled gitaly_ref_client.remote_branches(remote_name) else - rugged_remote_branches(remote_name) + Gitlab::GitalyClient::StorageSettings.allow_disk_access do + rugged_remote_branches(remote_name) + end end end end |