diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-04-06 17:52:12 +0200 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-04-06 17:52:12 +0200 |
commit | 91226c200151461b21e85cc8c85a103c93d6a17f (patch) | |
tree | ff94dfc45087e51a4753a58f6a1286f6f273c27a | |
parent | 6cc6d9730a234c2cc27869f9b9388ab61de9c460 (diff) | |
download | gitlab-ce-91226c200151461b21e85cc8c85a103c93d6a17f.tar.gz |
Move workhorse protocol code into lib
-rw-r--r-- | app/controllers/projects/git_http_controller.rb | 13 | ||||
-rw-r--r-- | lib/gitlab/workhorse.rb | 7 |
2 files changed, 12 insertions, 8 deletions
diff --git a/app/controllers/projects/git_http_controller.rb b/app/controllers/projects/git_http_controller.rb index a26ab736115..6dd7a683b0e 100644 --- a/app/controllers/projects/git_http_controller.rb +++ b/app/controllers/projects/git_http_controller.rb @@ -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 diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb index c3ddd4c2680..5b2982e4994 100644 --- a/lib/gitlab/workhorse.rb +++ b/lib/gitlab/workhorse.rb @@ -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, |