From cd22fdd531c151cf1bbc307e52c565e86070fe3b Mon Sep 17 00:00:00 2001
From: Lin Jen-Shin <godfat@godfat.org>
Date: Tue, 15 Nov 2016 08:21:16 +0800
Subject: [PATCH] @ref might not exist

---
 app/controllers/concerns/creates_commit.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/controllers/concerns/creates_commit.rb b/app/controllers/concerns/creates_commit.rb
index 643b61af1b2..5d11f286e9a 100644
--- a/app/controllers/concerns/creates_commit.rb
+++ b/app/controllers/concerns/creates_commit.rb
@@ -4,7 +4,7 @@ module CreatesCommit
   def create_commit(service, success_path:, failure_path:, failure_view: nil, success_notice: nil)
     set_commit_variables
 
-    source_branch = @ref if @repository.find_branch(@ref)
+    source_branch = @ref if @ref && @repository.find_branch(@ref)
     commit_params = @commit_params.merge(
       source_project: @project,
       source_branch: source_branch,
-- 
GitLab