From 2b0dc0a1009b92a1c236598049b0efa623f9c25d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 11 Oct 2012 12:58:03 -0400 Subject: 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.. --- Annex/Branch.hs | 4 +++- debian/changelog | 1 + doc/bugs/fatal:_empty_ident_name.mdwn | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Annex/Branch.hs b/Annex/Branch.hs index b1a807f24..3b056eed5 100644 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -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 diff --git a/debian/changelog b/debian/changelog index 73e33ea8d..1470cf943 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ git-annex (3.20121010) UNRELEASED; urgency=low * Standard groups changed to client, transfer, archive, and backup. Each of these has its own standard preferred content setting. * dead: Remove dead repository from all groups. + * Avoid unsetting HOME when running certian git commands. Closes: #690193 -- Joey Hess Wed, 10 Oct 2012 12:59:25 -0400 diff --git a/doc/bugs/fatal:_empty_ident_name.mdwn b/doc/bugs/fatal:_empty_ident_name.mdwn index d2f44375f..241477287 100644 --- a/doc/bugs/fatal:_empty_ident_name.mdwn +++ b/doc/bugs/fatal:_empty_ident_name.mdwn @@ -46,3 +46,6 @@ commit 56c037c69e75def74d6ea90de8aa8a1954c52178 Arch Linux **Please provide any additional information below.** > [[done]] by adding name to the user, in /etc/passwd. --Stone + +>> Actually, [[done]] by avoiding clobbering HOME when running some git +>> commands. --[[Joey]] -- cgit v1.2.3