From ace309d7755d6d50f85169649429e237ebb32b76 Mon Sep 17 00:00:00 2001
From: Patricio Cano <suprnova32@gmail.com>
Date: Thu, 23 Jun 2016 09:53:21 -0500
Subject: [PATCH] Raise an error if no protocol is passed to the GitAccess
 check.

---
 lib/gitlab/git/hook.rb   | 3 ++-
 lib/gitlab/git_access.rb | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/gitlab/git/hook.rb b/lib/gitlab/git/hook.rb
index 125240c8a8b..57c41b41298 100644
--- a/lib/gitlab/git/hook.rb
+++ b/lib/gitlab/git/hook.rb
@@ -1,6 +1,7 @@
 module Gitlab
   module Git
     class Hook
+      GL_PROTOCOL = 'web'.freeze
       attr_reader :name, :repo_path, :path
 
       def initialize(name, repo_path)
@@ -35,7 +36,7 @@ module Gitlab
         vars = {
           'GL_ID' => gl_id,
           'PWD' => repo_path,
-          'GL_PROTOCOL' => 'web'
+          'GL_PROTOCOL' => GL_PROTOCOL
         }
 
         options = {
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index d5f2713e935..beec56fcc62 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -50,7 +50,7 @@ module Gitlab
     end
 
     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?
 
-- 
GitLab