diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-04-20 15:04:38 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-04-20 15:04:38 -0400 |
commit | 3bcf2bfb2e02cf4b0edefedde2db4b257a2c5343 (patch) | |
tree | 5462f29b2e308858a1b84019a5f795aa385f4511 /Test.hs | |
parent | 5c23c1c2e6904e26b49cce1c9d0a1ba718e5938f (diff) |
Isolate test suite from global git config settings.
Diffstat (limited to 'Test.hs')
-rw-r--r-- | Test.hs | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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 |