Commit 91226c20 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Move workhorse protocol code into lib

parent 6cc6d973
...@@ -115,12 +115,12 @@ class Projects::GitHttpController < Projects::ApplicationController ...@@ -115,12 +115,12 @@ class Projects::GitHttpController < Projects::ApplicationController
end end
end end
def repo_path def repository
@repo_path ||= begin @repository ||= begin
if params[:project_id].end_with?('.wiki.git') if params[:project_id].end_with?('.wiki.git')
project.wiki.wiki.path project.wiki.repository
else else
repository.path_to_repo project.repository
end end
end end
end end
...@@ -142,10 +142,7 @@ class Projects::GitHttpController < Projects::ApplicationController ...@@ -142,10 +142,7 @@ class Projects::GitHttpController < Projects::ApplicationController
end end
def render_ok def render_ok
render json: { render json: Gitlab::Workhorse.git_http_ok(repository, user)
'GL_ID' => Gitlab::ShellEnv.gl_id(@user),
'RepoPath' => repo_path,
}
end end
def render_not_found def render_not_found
......
...@@ -6,6 +6,13 @@ module Gitlab ...@@ -6,6 +6,13 @@ module Gitlab
SEND_DATA_HEADER = 'Gitlab-Workhorse-Send-Data' SEND_DATA_HEADER = 'Gitlab-Workhorse-Send-Data'
class << self class << self
def git_http_ok(repository, user)
{
'GL_ID' => Gitlab::ShellEnv.gl_id(user),
'RepoPath' => repository.path_to_repo,
}
end
def send_git_blob(repository, blob) def send_git_blob(repository, blob)
params = { params = {
'RepoPath' => repository.path_to_repo, 'RepoPath' => repository.path_to_repo,
......
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