Avoid unsetting HOME when running certian git commands. Closes: #690193
Setting GIT_INDEX_FILE clobbers the rest of the environment, making git not read ~/.gitconfig, and blow up if GECOS didn't have a name for the user. I'm not entirely happy with getEnvironment being run every time now, that's somewhat expensive. It may make sense to just set GIT_COMMITTER_* and GIT_AUTHOR_*, but I worry that clobbering the rest could break PATH, or GIT_PATH, or something else that might be used by a command run in here. And caching the environment is not a good idea either; it can change..
This commit is contained in:
parent
bbf2c31aa7
commit
97ea08e2d1
3 changed files with 7 additions and 1 deletions
|
@ -22,6 +22,7 @@ module Annex.Branch (
|
|||
) where
|
||||
|
||||
import qualified Data.ByteString.Lazy.Char8 as L
|
||||
import System.Environment
|
||||
|
||||
import Common.Annex
|
||||
import Annex.BranchState
|
||||
|
@ -292,7 +293,8 @@ withIndex' :: Bool -> Annex a -> Annex a
|
|||
withIndex' bootstrapping a = do
|
||||
f <- fromRepo gitAnnexIndex
|
||||
g <- gitRepo
|
||||
let g' = g { gitEnv = Just [("GIT_INDEX_FILE", f)] }
|
||||
e <- liftIO getEnvironment
|
||||
let g' = g { gitEnv = Just $ ("GIT_INDEX_FILE", f):e }
|
||||
|
||||
Annex.changeState $ \s -> s { Annex.repo = g' }
|
||||
checkIndexOnce $ unlessM (liftIO $ doesFileExist f) $ do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue