diff options
-rw-r--r-- | Annex/Branch.hs | 14 | ||||
-rw-r--r-- | doc/design/assistant/android.mdwn | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/Annex/Branch.hs b/Annex/Branch.hs index 69b68cf7a..95ac49404 100644 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -5,6 +5,8 @@ - Licensed under the GNU GPL version 3 or higher. -} +{-# LANGUAGE CPP #-} + module Annex.Branch ( fullname, name, @@ -22,7 +24,7 @@ module Annex.Branch ( ) where import qualified Data.ByteString.Lazy.Char8 as L -import System.Environment +import System.Posix.Env import Common.Annex import Annex.BranchState @@ -285,7 +287,17 @@ withIndex' :: Bool -> Annex a -> Annex a withIndex' bootstrapping a = do f <- fromRepo gitAnnexIndex g <- gitRepo +#ifdef WITH_ANDROID + {- Work around for weird getEnvironment breakage on Android. See + - https://github.com/neurocyte/ghc-android/issues/7 + - Instead, use getEnv to get some key environment variables that + - git expects to have. -} + let keyenv = words "USER PATH GIT_EXEC_PATH HOSTNAME HOME" + let getEnvPair k = maybe Nothing (\v -> Just (k, v)) <$> getEnv k + e <- liftIO $ catMaybes <$> forM keyenv getEnvPair +#else e <- liftIO getEnvironment +#endif let g' = g { gitEnv = Just $ ("GIT_INDEX_FILE", f):e } Annex.changeState $ \s -> s { Annex.repo = g' } diff --git a/doc/design/assistant/android.mdwn b/doc/design/assistant/android.mdwn index 3f08143ca..2fe2145ef 100644 --- a/doc/design/assistant/android.mdwn +++ b/doc/design/assistant/android.mdwn @@ -33,3 +33,5 @@ file modes, etc. * Make git stop complaining that "warning: no threads uspport, ignoring --threads" * git does not support http remotes. To fix, need to port libcurl and allow git to link to it. +* getEnvironment is broken on Android <https://github.com/neurocyte/ghc-android/issues/7> + and a few places use it. |