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.)

This commit is contained in:
Joey Hess 2014-01-14 15:36:33 -04:00
parent 188f0bd58d
commit d07f2d7865
7 changed files with 31 additions and 11 deletions

View file

@ -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)