From 0e033b31248a48bd02ae67aada106f99a2af53f9 Mon Sep 17 00:00:00 2001 From: John Cai Date: Tue, 30 Apr 2019 21:45:19 -0700 Subject: Add client methods for DisconnectGitAlternates rpc DisconnectGitAlternates is a Gitaly RPC that will delete a repository's objects/info/alternates file. This commit adds client support for that RPC. --- lib/gitlab/git/repository.rb | 6 ++++++ lib/gitlab/gitaly_client/repository_service.rb | 8 ++++++++ 2 files changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 508499f227c..fc9bcbdcca2 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -922,6 +922,12 @@ module Gitlab end end + def disconnect_alternates + wrapped_gitaly_errors do + gitaly_repository_client.disconnect_alternates + end + end + def gitaly_repository Gitlab::GitalyClient::Util.repository(@storage, @relative_path, @gl_repository, @gl_project_path) end diff --git a/lib/gitlab/gitaly_client/repository_service.rb b/lib/gitlab/gitaly_client/repository_service.rb index 74aae4a8e97..68b17e86608 100644 --- a/lib/gitlab/gitaly_client/repository_service.rb +++ b/lib/gitlab/gitaly_client/repository_service.rb @@ -331,6 +331,14 @@ module Gitlab search_results_from_response(response) end + def disconnect_alternates + request = Gitaly::DisconnectGitAlternatesRequest.new( + repository: @gitaly_repo + ) + + GitalyClient.call(@storage, :object_pool_service, :disconnect_git_alternates, request) + end + private def search_results_from_response(gitaly_response) -- cgit v1.2.1