summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-08-10 16:08:48 +0200
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-08-30 20:50:10 +0200
commit0fd958a3bd0a879c1c99cc649b77e67c5ee8c901 (patch)
treeee1d2b362267d9f925ec7160f5174f0c807b98fe
parent7e90a12d9cfd7c5649e8a93fd32425811f692d78 (diff)
downloadgitlab-ce-ee-gitaly-440-shell-fetch-remote.tar.gz
Migrate Repository.FetchRemote to Gitalyee-gitaly-440-shell-fetch-remote
- `Gitlab::Shell.fetch_remote` now takes a `Gitlab::Git::Repository` instead
-rw-r--r--GITALY_SERVER_VERSION2
-rw-r--r--lib/gitlab/shell.rb6
-rw-r--r--spec/lib/gitlab/shell_spec.rb21
3 files changed, 13 insertions, 16 deletions
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION
index fbc18a42b0f..85e60ed180c 100644
--- a/GITALY_SERVER_VERSION
+++ b/GITALY_SERVER_VERSION
@@ -1 +1 @@
-=5d2f27592bf5c43b58559ccb57f05c0e03b792da
+0.34.0
diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb
index b2e64a53aa5..dbd1cd3ceb1 100644
--- a/lib/gitlab/shell.rb
+++ b/lib/gitlab/shell.rb
@@ -139,7 +139,7 @@ module Gitlab
def fetch_remote(repository, remote, ssh_auth: nil, forced: false, no_tags: false)
gitaly_migrate(:fetch_remote) do |is_enabled|
if is_enabled
- gitaly_repository_client(repository).fetch_remote(remote, ssh_auth: ssh_auth, forced: forced, no_tags: no_tags)
+ repository.gitaly_repository_client.fetch_remote(remote, ssh_auth: ssh_auth, forced: forced, no_tags: no_tags)
else
storage_path = Gitlab.config.repositories.storages[repository.storage]["path"]
local_fetch_remote(storage_path, repository.relative_path, remote, ssh_auth: ssh_auth, forced: forced, no_tags: no_tags)
@@ -493,10 +493,6 @@ module Gitlab
Bundler.with_original_env { Popen.popen(cmd, nil, vars) }
end
- def gitaly_repository_client(repo)
- Gitlab::GitalyClient::RepositoryService.new(repo)
- end
-
def gitaly_migrate(method, &block)
Gitlab::GitalyClient.migrate(method, &block)
rescue GRPC::NotFound, GRPC::BadStatus => e
diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb
index 93202f6a4da..071e2e7e274 100644
--- a/spec/lib/gitlab/shell_spec.rb
+++ b/spec/lib/gitlab/shell_spec.rb
@@ -543,19 +543,20 @@ describe Gitlab::Shell do
Gitlab.config.gitlab_shell.git_timeout.to_s
]
- if fail
- expect(Gitlab::Popen).to receive(:popen).with(popen_args, nil, popen_vars.merge(vars)).and_return(["error", 1])
- else
- expect(Gitlab::Popen).to receive(:popen).with(popen_args, nil, popen_vars.merge(vars)).and_return([nil, 0])
- end
+ return_value = fail ? ["error", 1] : [nil, 0]
+
+ expect(Gitlab::Popen).to receive(:popen).with(popen_args, nil, popen_vars.merge(vars)).and_return(return_value)
end
def expect_gitaly_call(fail, vars = {})
- if fail
- expect_any_instance_of(Gitlab::GitalyClient::RepositoryService).to receive(:fetch_remote).and_raise(GRPC::NotFound)
- else
- expect_any_instance_of(Gitlab::GitalyClient::RepositoryService).to receive(:fetch_remote).and_return(true)
- end
+ receive_fetch_remote =
+ if fail
+ receive(:fetch_remote).and_raise(GRPC::NotFound)
+ else
+ receive(:fetch_remote).and_return(true)
+ end
+
+ expect_any_instance_of(Gitlab::GitalyClient::RepositoryService).to receive_fetch_remote
end
if gitaly_on