From a87f9b63077c8b93f4b2284d494c0081bd938f8d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 15 Oct 2014 20:33:52 -0400 Subject: 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. --- Git/CurrentRepo.hs | 10 +--------- Git/Index.hs | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) (limited to 'Git') diff --git a/Git/CurrentRepo.hs b/Git/CurrentRepo.hs index 23ebbbcad..f611f7a34 100644 --- a/Git/CurrentRepo.hs +++ b/Git/CurrentRepo.hs @@ -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 diff --git a/Git/Index.hs b/Git/Index.hs index d712245a8..c42ac42f8 100644 --- a/Git/Index.hs +++ b/Git/Index.hs @@ -21,8 +21,8 @@ import Utility.Env override :: FilePath -> IO (IO ()) override index = do res <- getEnv var - void $ setEnv var index True - return $ void $ reset res + setEnv var index True + return $ reset res where var = "GIT_INDEX_FILE" reset (Just v) = setEnv var v True -- cgit v1.2.3