Isolate test suite from global git config settings.

This commit is contained in:
Joey Hess 2016-04-20 15:04:38 -04:00
parent b56218f0c2
commit c3fdaf764d
Failed to extract signature
3 changed files with 15 additions and 0 deletions

10
Test.hs
View file

@ -112,6 +112,7 @@ optParser = TestOptions
runner :: Maybe (TestOptions -> IO ()) runner :: Maybe (TestOptions -> IO ())
runner = Just $ \opts -> do runner = Just $ \opts -> do
ensuretmpdir ensuretmpdir
isolateGitConfig
crippledfilesystem <- Annex.Init.probeCrippledFileSystem' tmpdir crippledfilesystem <- Annex.Init.probeCrippledFileSystem' tmpdir
case tryIngredients ingredients (tastyOptionSet opts) (tests crippledfilesystem opts) of case tryIngredients ingredients (tastyOptionSet opts) (tests crippledfilesystem opts) of
Nothing -> error "No tests found!?" Nothing -> error "No tests found!?"
@ -1788,6 +1789,15 @@ ensuretmpdir = do
unless e $ unless e $
createDirectory tmpdir 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 :: FilePath -> IO ()
cleanup = cleanup' False cleanup = cleanup' False

1
debian/changelog vendored
View file

@ -10,6 +10,7 @@ git-annex (6.20160419) UNRELEASED; urgency=medium
to refer to a file. to refer to a file.
* Fix bug that prevented annex.sshcaching=false configuration from taking * Fix bug that prevented annex.sshcaching=false configuration from taking
effect when on a crippled filesystem. Thanks, divergentdave. effect when on a crippled filesystem. Thanks, divergentdave.
* Isolate test suite from global git config settings.
-- Joey Hess <id@joeyh.name> Tue, 19 Apr 2016 12:57:15 -0400 -- Joey Hess <id@joeyh.name> Tue, 19 Apr 2016 12:57:15 -0400

View file

@ -105,3 +105,7 @@ found a bug report from you on
be related, but I don't know if that's the case. The newest version I'm be related, but I don't know if that's the case. The newest version I'm
able to build is 5.20150219, somewhere after that various things start able to build is 5.20150219, somewhere after that various things start
to fail. to fail.
> [[fixed|done]]; I found a way to isolate the test suite from global git
> configs, by setting `GIT_CONFIG_NOSYSTEM` and also setting
> `HOME` and `XDG_CONFIG_HOME` to an empty directory. --[[Joey]]