diff options
author | Joey Hess <joey@kitenet.net> | 2014-01-14 15:36:33 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-01-14 15:36:33 -0400 |
commit | e6f32bd11c94221f82fe9acf6ecb74be2fab4a76 (patch) | |
tree | f52a5aa501875340c05f34c151fd027036cff83a /Remote | |
parent | 44b6bc589b6e2219cd3a4cf57fd2dd30068b2744 (diff) |
Fix a long-standing bug that could cause the wrong index file to be used when committing to the git-annex branch, if GIT_INDEX_FILE is set in the environment. This typically resulted in git-annex branch log files being committed to the master branch and later showing up in the work tree. (These log files can be safely removed.)
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Git.hs | 9 | ||||
-rw-r--r-- | Remote/Glacier.hs | 3 | ||||
-rw-r--r-- | Remote/Hook.hs | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs index 900b60926..4c6b95f60 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -54,6 +54,7 @@ import Control.Concurrent import Control.Concurrent.MSampleVar import System.Process (std_in, std_err) import qualified Data.Map as M +import qualified Data.AssocList as A import Control.Exception.Extensible remote :: RemoteType @@ -414,13 +415,13 @@ fsckOnRemote r params Just (c, ps) -> batchCommand c ps | otherwise = return $ do program <- readProgramFile - env <- getEnvironment r' <- Git.Config.read r - let env' = + env <- getEnvironment + let env' = A.addEntries [ ("GIT_WORK_TREE", Git.repoPath r') , ("GIT_DIR", Git.localGitDir r') - ] ++ env - batchCommandEnv program (Param "fsck" : params) (Just env') + ] env + batchCommandEnv program (Param "fsck" : params) $ Just env' {- The passed repair action is run in the Annex monad of the remote. -} repairRemote :: Git.Repo -> Annex Bool -> Annex (IO Bool) diff --git a/Remote/Glacier.hs b/Remote/Glacier.hs index 78b573506..f0ff8d738 100644 --- a/Remote/Glacier.hs +++ b/Remote/Glacier.hs @@ -9,6 +9,7 @@ module Remote.Glacier (remote, jobList) where import qualified Data.Map as M import qualified Data.Text as T +import Data.AssocList as A import System.Environment import Common.Annex @@ -232,7 +233,7 @@ glacierEnv c u = go =<< getRemoteCredPairFor "glacier" c creds go Nothing = return Nothing go (Just (user, pass)) = do e <- liftIO getEnvironment - return $ Just $ (uk, user):(pk, pass):e + return $ Just $ A.addEntries [(uk, user), (pk, pass)] e creds = AWS.creds u (uk, pk) = credPairEnvironment creds diff --git a/Remote/Hook.hs b/Remote/Hook.hs index 056ad264c..d2ce48ddb 100644 --- a/Remote/Hook.hs +++ b/Remote/Hook.hs @@ -9,6 +9,7 @@ module Remote.Hook (remote) where import qualified Data.ByteString.Lazy as L import qualified Data.Map as M +import qualified Data.AssocList as A import System.Environment import Common.Annex @@ -77,8 +78,7 @@ hookSetup mu c = do hookEnv :: Action -> Key -> Maybe FilePath -> IO (Maybe [(String, String)]) hookEnv action k f = Just <$> mergeenv (fileenv f ++ keyenv) where - mergeenv l = M.toList . M.union (M.fromList l) - <$> M.fromList <$> getEnvironment + mergeenv l = A.addEntries l <$> getEnvironment env s v = ("ANNEX_" ++ s, v) keyenv = catMaybes [ Just $ env "KEY" (key2file k) |