diff --git a/Gemfile b/Gemfile index 562ee2d1b9ed7e720283d8551b9fa0de699551ef..0c6bb805b9882b5942d20428bcb3eb26b75557f1 100644 --- a/Gemfile +++ b/Gemfile @@ -352,4 +352,4 @@ gem 'vmstat', '~> 2.3.0' gem 'sys-filesystem', '~> 1.1.6' # Gitaly GRPC client -gem 'gitaly', '~> 0.3.0' +gem 'gitaly', '~> 0.5.0' diff --git a/Gemfile.lock b/Gemfile.lock index 8382de2b7a059de14e87ad2f284ee3eb2f84815d..304fc9f2bb399a5a5f301f7f430fccbeea51aa1e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -253,7 +253,7 @@ GEM json get_process_mem (0.2.0) gherkin-ruby (0.3.2) - gitaly (0.3.0) + gitaly (0.5.0) google-protobuf (~> 3.1) grpc (~> 1.0) github-linguist (4.7.6) @@ -899,7 +899,7 @@ DEPENDENCIES fuubar (~> 2.0.0) gemnasium-gitlab-service (~> 0.2) gemojione (~> 3.0) - gitaly (~> 0.3.0) + gitaly (~> 0.5.0) github-linguist (~> 4.7.0) gitlab-flowdock-git-hook (~> 1.0.1) gitlab-markup (~> 1.5.1) diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb index 6fe85af3c30d5143d489f534d6e45e065f118db4..d1131ad65e00a206bbebb8abfe3197fe04157a91 100644 --- a/lib/gitlab/workhorse.rb +++ b/lib/gitlab/workhorse.rb @@ -17,14 +17,22 @@ module Gitlab class << self def git_http_ok(repository, user) + repo_path = repository.path_to_repo params = { GL_ID: Gitlab::GlId.gl_id(user), - RepoPath: repository.path_to_repo, + RepoPath: repo_path, } if Gitlab.config.gitaly.enabled - address = Gitlab::GitalyClient.get_address(repository.project.repository_storage) + storage = repository.project.repository_storage + address = Gitlab::GitalyClient.get_address(storage) params[:GitalySocketPath] = URI(address).path + # TODO: use GitalyClient code to assemble the Repository message + params[:Repository] = Gitaly::Repository.new( + path: repo_path, + storage_name: storage, + relative_path: Gitlab::RepoPath.strip_storage_path(repo_path), + ).to_h end params diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb index 535c96eeee9aa12ac8a2d2b82f28cb1c7223bc9f..cb7c810124e128fe74ec23217202956ad91f7b50 100644 --- a/spec/lib/gitlab/workhorse_spec.rb +++ b/spec/lib/gitlab/workhorse_spec.rb @@ -179,10 +179,11 @@ describe Gitlab::Workhorse, lib: true do describe '.git_http_ok' do let(:user) { create(:user) } + let(:repo_path) { repository.path_to_repo } subject { described_class.git_http_ok(repository, user) } - it { expect(subject).to eq({ GL_ID: "user-#{user.id}", RepoPath: repository.path_to_repo }) } + it { expect(subject).to eq({ GL_ID: "user-#{user.id}", RepoPath: repo_path }) } context 'when Gitaly is enabled' do before do @@ -192,6 +193,11 @@ describe Gitlab::Workhorse, lib: true do it 'includes Gitaly params in the returned value' do gitaly_socket_path = URI(Gitlab::GitalyClient.get_address('default')).path expect(subject).to include({ GitalySocketPath: gitaly_socket_path }) + expect(subject[:Repository]).to include({ + path: repo_path, + storage_name: 'default', + relative_path: project.full_path + '.git', + }) end end end