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.
This commit is contained in:
Joey Hess 2013-11-22 23:27:15 -04:00
parent b9cdb55e0c
commit 0980f3dae6
2 changed files with 9 additions and 2 deletions

View file

@ -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