Use haskell setenv library to clean up several ugly workarounds for inability to manipulate the environment on windows.
Didn't know that this library existed! This includes making git-annex not re-exec itself on start on windows, and making the test suite on Windows run tests without forking.
This commit is contained in:
parent
65280d91e7
commit
1e59df083d
12 changed files with 40 additions and 79 deletions
|
@ -5,17 +5,13 @@
|
|||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE CPP #-}
|
||||
|
||||
module Git.CurrentRepo where
|
||||
|
||||
import Common
|
||||
import Git.Types
|
||||
import Git.Construct
|
||||
import qualified Git.Config
|
||||
#ifndef mingw32_HOST_OS
|
||||
import Utility.Env
|
||||
#endif
|
||||
|
||||
{- Gets the current git repository.
|
||||
-
|
||||
|
@ -42,17 +38,13 @@ get = do
|
|||
setCurrentDirectory d
|
||||
return $ addworktree wt r
|
||||
where
|
||||
#ifndef mingw32_HOST_OS
|
||||
pathenv s = do
|
||||
v <- getEnv s
|
||||
case v of
|
||||
Just d -> do
|
||||
void $ unsetEnv s
|
||||
unsetEnv s
|
||||
Just <$> absPath d
|
||||
Nothing -> return Nothing
|
||||
#else
|
||||
pathenv _ = return Nothing
|
||||
#endif
|
||||
|
||||
configure Nothing (Just r) = Git.Config.read r
|
||||
configure (Just d) _ = do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue