summaryrefslogtreecommitdiff
path: root/lib/gitlab/workhorse.rb
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-07-14 11:22:12 +0100
committerPhil Hughes <me@iamphill.com>2017-07-14 11:22:12 +0100
commitb85d69d1f0b379b2b055eca9695f8055b00e77b5 (patch)
tree882cbe797390f1a726174a8283e00c3e62404a5e /lib/gitlab/workhorse.rb
parent7b1affd426fbf24445df25e439cbda9b6bd4b046 (diff)
parent0c4f512bae5b5e67658dd9707430185f1a1f97cc (diff)
downloadgitlab-ce-b85d69d1f0b379b2b055eca9695f8055b00e77b5.tar.gz
Merge branch 'master' into new-nav-fix-contextual-breadcrumbs
Diffstat (limited to 'lib/gitlab/workhorse.rb')
-rw-r--r--lib/gitlab/workhorse.rb26
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb
index ee4f2b773ea..916ef365d78 100644
--- a/lib/gitlab/workhorse.rb
+++ b/lib/gitlab/workhorse.rb
@@ -62,10 +62,21 @@ module Gitlab
end
def send_git_blob(repository, blob)
- params = {
- 'RepoPath' => repository.path_to_repo,
- 'BlobId' => blob.id
- }
+ params = if Gitlab::GitalyClient.feature_enabled?(:project_raw_show)
+ {
+ 'GitalyServer' => gitaly_server_hash(repository),
+ 'GetBlobRequest' => {
+ repository: repository.gitaly_repository.to_h,
+ oid: blob.id,
+ limit: -1
+ }
+ }
+ else
+ {
+ 'RepoPath' => repository.path_to_repo,
+ 'BlobId' => blob.id
+ }
+ end
[
SEND_DATA_HEADER,
@@ -192,6 +203,13 @@ module Gitlab
def encode(hash)
Base64.urlsafe_encode64(JSON.dump(hash))
end
+
+ def gitaly_server_hash(repository)
+ {
+ address: Gitlab::GitalyClient.address(repository.project.repository_storage),
+ token: Gitlab::GitalyClient.token(repository.project.repository_storage)
+ }
+ end
end
end
end