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:
parent
188f0bd58d
commit
d07f2d7865
7 changed files with 31 additions and 11 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue