Move workhorse protocol code into lib

This commit is contained in:
Jacob Vosmaer 2016-04-06 17:52:12 +02:00
parent 6cc6d9730a
commit 91226c2001
2 changed files with 12 additions and 8 deletions

View File

@ -115,12 +115,12 @@ class Projects::GitHttpController < Projects::ApplicationController
end
end
def repo_path
@repo_path ||= begin
def repository
@repository ||= begin
if params[:project_id].end_with?('.wiki.git')
project.wiki.wiki.path
project.wiki.repository
else
repository.path_to_repo
project.repository
end
end
end
@ -142,10 +142,7 @@ class Projects::GitHttpController < Projects::ApplicationController
end
def render_ok
render json: {
'GL_ID' => Gitlab::ShellEnv.gl_id(@user),
'RepoPath' => repo_path,
}
render json: Gitlab::Workhorse.git_http_ok(repository, user)
end
def render_not_found

View File

@ -6,6 +6,13 @@ module Gitlab
SEND_DATA_HEADER = 'Gitlab-Workhorse-Send-Data'
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)
params = {
'RepoPath' => repository.path_to_repo,