From 3bcf2bfb2e02cf4b0edefedde2db4b257a2c5343 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 20 Apr 2016 15:04:38 -0400 Subject: Isolate test suite from global git config settings. --- Test.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Test.hs') diff --git a/Test.hs b/Test.hs index 03492adfc..f7faf476b 100644 --- a/Test.hs +++ b/Test.hs @@ -112,6 +112,7 @@ optParser = TestOptions runner :: Maybe (TestOptions -> IO ()) runner = Just $ \opts -> do ensuretmpdir + isolateGitConfig crippledfilesystem <- Annex.Init.probeCrippledFileSystem' tmpdir case tryIngredients ingredients (tastyOptionSet opts) (tests crippledfilesystem opts) of Nothing -> error "No tests found!?" @@ -1787,6 +1788,15 @@ ensuretmpdir = do e <- doesDirectoryExist tmpdir unless e $ createDirectory tmpdir + +{- Prevent global git configs from affecting the test suite. -} +isolateGitConfig :: IO () +isolateGitConfig = do + let tmphome = tmpdir "home" + createDirectoryIfMissing False tmphome + Utility.Env.setEnv "HOME" tmphome True + Utility.Env.setEnv "XDG_CONFIG_HOME" tmphome True + Utility.Env.setEnv "GIT_CONFIG_NOSYSTEM" "1" True cleanup :: FilePath -> IO () cleanup = cleanup' False -- cgit v1.2.3