From 0f1d8e771f3115c12af9ca6e24ea57b2f403b826 Mon Sep 17 00:00:00 2001
From: Robert Speicher <rspeicher@gmail.com>
Date: Fri, 27 Mar 2015 16:39:41 -0400
Subject: [PATCH] Define GIT_TEMPLATE_DIR environment variable in TestEnv

See http://schacon.github.io/git/git-init.html#_template_directory

Without this variable, any global git hooks a developer might have in
~/.git_template would be linked in the `.git/hooks` folder for every
test repository that gets checked out by TestEnv, and would cause
certain specs to fail due to pre-existing hook files.
---
 spec/support/test_env.rb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index f869488d8d8..44d70e741b2 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -85,7 +85,7 @@ module TestEnv
     end
 
     # We must copy bare repositories because we will push to them.
-    system(*%W(git clone -q --bare #{factory_repo_path} #{factory_repo_path_bare}))
+    system(git_env, *%W(git clone -q --bare #{factory_repo_path} #{factory_repo_path_bare}))
   end
 
   def copy_repo(project)
@@ -113,4 +113,10 @@ module TestEnv
   def factory_repo_name
     'gitlab-test'
   end
+
+  # Prevent developer git configurations from being persisted to test
+  # repositories
+  def git_env
+    {'GIT_TEMPLATE_DIR' => ''}
+  end
 end
-- 
GitLab