Commit ace309d7 authored by Patricio Cano's avatar Patricio Cano

Raise an error if no protocol is passed to the GitAccess check.

parent 42fb2516
module Gitlab module Gitlab
module Git module Git
class Hook class Hook
GL_PROTOCOL = 'web'.freeze
attr_reader :name, :repo_path, :path attr_reader :name, :repo_path, :path
def initialize(name, repo_path) def initialize(name, repo_path)
...@@ -35,7 +36,7 @@ module Gitlab ...@@ -35,7 +36,7 @@ module Gitlab
vars = { vars = {
'GL_ID' => gl_id, 'GL_ID' => gl_id,
'PWD' => repo_path, 'PWD' => repo_path,
'GL_PROTOCOL' => 'web' 'GL_PROTOCOL' => GL_PROTOCOL
} }
options = { options = {
......
...@@ -50,7 +50,7 @@ module Gitlab ...@@ -50,7 +50,7 @@ module Gitlab
end end
def check(cmd, changes = nil) def check(cmd, changes = nil)
return build_status_object(false, 'Access denied due to unspecified Git access protocol') unless protocol raise 'Access denied due to unspecified Git access protocol' unless protocol
return build_status_object(false, "Git access over #{protocol.upcase} is not allowed") unless protocol_allowed? return build_status_object(false, "Git access over #{protocol.upcase} is not allowed") unless protocol_allowed?
......
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