From fdfd56c647d685ad5618917341db0b7c97e1b63a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 8 Apr 2016 14:24:00 -0400 Subject: avoid withWorkTreeRelated affecting annex symlink calculation --- Annex/GitOverlay.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Annex') diff --git a/Annex/GitOverlay.hs b/Annex/GitOverlay.hs index 4230ed4a4..7e18d225b 100644 --- a/Annex/GitOverlay.hs +++ b/Annex/GitOverlay.hs @@ -45,11 +45,13 @@ withWorkTreeRelated :: FilePath -> Annex a -> Annex a withWorkTreeRelated d = withAltRepo modrepo unmodrepo where modrepo g = do - let g' = g { location = modlocation (location g) } - addGitEnv g' "GIT_COMMON_DIR" =<< absPath (localGitDir g) - unmodrepo g g' = g' { gitEnv = gitEnv g, location = location g } - modlocation l@(Local {}) = l { gitdir = d } - modlocation _ = error "withWorkTreeRelated of non-local git repo" + g' <- addGitEnv g "GIT_COMMON_DIR" =<< absPath (localGitDir g) + g'' <- addGitEnv g' "GIT_DIR" d + return (g'' { gitEnvOverridesGitDir = True }) + unmodrepo g g' = g' + { gitEnv = gitEnv g + , gitEnvOverridesGitDir = gitEnvOverridesGitDir g + } withAltRepo :: (Repo -> IO Repo) -- cgit v1.2.3