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 = 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

1
debian/changelog vendored
View file

@ -10,6 +10,7 @@ git-annex (6.20160419) UNRELEASED; urgency=medium
to refer to a file.
* Fix bug that prevented annex.sshcaching=false configuration from taking
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

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
able to build is 5.20150219, somewhere after that various things start
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]]