Commit acc0e25d authored by Alejandro Rodríguez's avatar Alejandro Rodríguez

Incorporate Gitaly's RepositoryService.IsSquashInProgress RPC

parent b2761d17
......@@ -1234,8 +1234,14 @@ module Gitlab
end
def squash_in_progress?(squash_id)
gitaly_migrate(:squash_in_progress) do |is_enabled|
if is_enabled
gitaly_repository_client.squash_in_progress?(squash_id)
else
fresh_worktree?(worktree_path(SQUASH_WORKTREE_PREFIX, squash_id))
end
end
end
def push_remote_branches(remote_name, branch_names, forced: true)
success = @gitlab_projects.push_branches(remote_name, GITLAB_PROJECTS_TIMEOUT, forced, branch_names)
......
......@@ -134,6 +134,23 @@ module Gitlab
response.in_progress
end
def squash_in_progress?(squash_id)
request = Gitaly::IsSquashInProgressRequest.new(
repository: @gitaly_repo,
squash_id: squash_id.to_s
)
response = GitalyClient.call(
@storage,
:repository_service,
:is_squash_in_progress,
request,
timeout: GitalyClient.default_timeout
)
response.in_progress
end
def fetch_source_branch(source_repository, source_branch, local_ref)
request = Gitaly::FetchSourceBranchRequest.new(
repository: @gitaly_repo,
......
......@@ -84,4 +84,30 @@ describe Gitlab::GitalyClient::RepositoryService do
expect(client.has_local_branches?).to be(true)
end
end
describe '#rebase_in_progress?' do
let(:rebase_id) { 1 }
it 'sends a repository_rebase_in_progress message' do
expect_any_instance_of(Gitaly::RepositoryService::Stub)
.to receive(:is_rebase_in_progress)
.with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash))
.and_return(double(in_progress: true))
client.rebase_in_progress?(rebase_id)
end
end
describe '#squash_in_progress?' do
let(:squash_id) { 1 }
it 'sends a repository_squash_in_progress message' do
expect_any_instance_of(Gitaly::RepositoryService::Stub)
.to receive(:is_squash_in_progress)
.with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash))
.and_return(double(in_progress: true))
client.squash_in_progress?(squash_id)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment