summaryrefslogtreecommitdiff
path: root/Annex/GitOverlay.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-04-08 14:24:00 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-04-08 14:24:00 -0400
commitfdfd56c647d685ad5618917341db0b7c97e1b63a (patch)
treea287e49f51af48f27a23711abb346134c218977d /Annex/GitOverlay.hs
parent6f4b9f2df58684d4b8e2099be59283be97f1318e (diff)
avoid withWorkTreeRelated affecting annex symlink calculation
Diffstat (limited to 'Annex/GitOverlay.hs')
-rw-r--r--Annex/GitOverlay.hs12
1 files changed, 7 insertions, 5 deletions
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)