summaryrefslogtreecommitdiff
path: root/Git
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-22 23:27:15 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-22 23:27:15 -0400
commit52ad9a1528bc51f65411aca263def97615367943 (patch)
treedcc336dd8e155c2ca4f12f90cc137569073bd752 /Git
parent14ccfc0abc1aa3130b07e7bd981b266f2eccd751 (diff)
Fix bug that broke switching between local repositories in the webapp when they use the new guarded direct mode.
git treats eg ~/annex as a bare git repository located in ~/.annex/.git if ~/annex/.git/config has core.bare=true.
Diffstat (limited to 'Git')
-rw-r--r--Git/Config.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Git/Config.hs b/Git/Config.hs
index 1919ecedf..b5c1be04a 100644
--- a/Git/Config.hs
+++ b/Git/Config.hs
@@ -110,8 +110,13 @@ store s repo = do
-}
updateLocation :: Repo -> IO Repo
updateLocation r@(Repo { location = LocalUnknown d })
- | isBare r = updateLocation' r $ Local d Nothing
- | otherwise = updateLocation' r $ Local (d </> ".git") (Just d)
+ | isBare r = ifM (doesDirectoryExist dotgit)
+ ( updateLocation' r $ Local dotgit Nothing
+ , updateLocation' r $ Local d Nothing
+ )
+ | otherwise = updateLocation' r $ Local dotgit (Just d)
+ where
+ dotgit = (d </> ".git")
updateLocation r@(Repo { location = l@(Local {}) }) = updateLocation' r l
updateLocation r = return r