summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Git/CurrentRepo.hs10
-rw-r--r--test.hs1
2 files changed, 6 insertions, 5 deletions
diff --git a/Git/CurrentRepo.hs b/Git/CurrentRepo.hs
index 4325f452c..746904caf 100644
--- a/Git/CurrentRepo.hs
+++ b/Git/CurrentRepo.hs
@@ -29,20 +29,22 @@ import qualified Git.Config
-}
get :: IO Repo
get = do
- gd <- takeenv "GIT_DIR"
+ gd <- pathenv "GIT_DIR"
r <- configure gd =<< maybe fromCwd fromPath gd
- wt <- maybe (worktree $ location r) Just <$> takeenv "GIT_WORK_TREE"
+ wt <- maybe (worktree $ location r) Just <$> pathenv "GIT_WORK_TREE"
case wt of
Nothing -> return r
Just d -> do
changeWorkingDirectory d
return $ addworktree wt r
where
- takeenv s = do
+ pathenv s = do
v <- getEnv s
when (isJust v) $
unsetEnv s
- return v
+ case v of
+ Nothing -> return Nothing
+ Just d -> Just <$> absPath d
configure Nothing r = Git.Config.read r
configure (Just d) r = do
r' <- Git.Config.read r
diff --git a/test.hs b/test.hs
index c52a88d66..9a0fce873 100644
--- a/test.hs
+++ b/test.hs
@@ -25,7 +25,6 @@ import qualified Utility.SafeCommand
import qualified Annex
import qualified Annex.UUID
import qualified Backend
-import qualified Git.Config
import qualified Git.CurrentRepo
import qualified Git.Filename
import qualified Locations