avoid failing if a local repo is not currently available

The added check if a repo is bare means its config needs to be read, but
in this case it cannot be. That means that a repo currently not available
is assumed to be non-bare.
This commit is contained in:
Joey Hess 2011-03-03 17:33:15 -04:00
parent eeadc2e3e0
commit e49e6a403b

View file

@ -163,12 +163,15 @@ repoIsSsh Repo { location = Url url }
| otherwise = False | otherwise = False
repoIsSsh _ = False repoIsSsh _ = False
configAvail ::Repo -> Bool
configAvail Repo { config = c } = c /= Map.empty
repoIsLocalBare :: Repo -> Bool repoIsLocalBare :: Repo -> Bool
repoIsLocalBare r@(Repo { location = Dir _ }) = configBare r repoIsLocalBare r@(Repo { location = Dir _ }) = configAvail r && configBare r
repoIsLocalBare _ = False repoIsLocalBare _ = False
repoIsLocalFull :: Repo -> Bool repoIsLocalFull :: Repo -> Bool
repoIsLocalFull r@(Repo { location = Dir _ }) = not $ configBare r repoIsLocalFull r@(Repo { location = Dir _ }) = configAvail r && not (configBare r)
repoIsLocalFull _ = False repoIsLocalFull _ = False
assertLocal :: Repo -> a -> a assertLocal :: Repo -> a -> a