summaryrefslogtreecommitdiff
path: root/GitRepo.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-03-03 17:33:15 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-03-03 17:33:15 -0400
commite49e6a403b16cd12594239e18fa708aab61243a9 (patch)
treeb01f368b8054cd70847bf1bb098571bc12a32c8c /GitRepo.hs
parenteeadc2e3e041b77e409bfe258ebe6a778f70ccb5 (diff)
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.
Diffstat (limited to 'GitRepo.hs')
-rw-r--r--GitRepo.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/GitRepo.hs b/GitRepo.hs
index ba0125121..92539eb82 100644
--- a/GitRepo.hs
+++ b/GitRepo.hs
@@ -163,12 +163,15 @@ repoIsSsh Repo { location = Url url }
| otherwise = False
repoIsSsh _ = False
+configAvail ::Repo -> Bool
+configAvail Repo { config = c } = c /= Map.empty
+
repoIsLocalBare :: Repo -> Bool
-repoIsLocalBare r@(Repo { location = Dir _ }) = configBare r
+repoIsLocalBare r@(Repo { location = Dir _ }) = configAvail r && configBare r
repoIsLocalBare _ = False
repoIsLocalFull :: Repo -> Bool
-repoIsLocalFull r@(Repo { location = Dir _ }) = not $ configBare r
+repoIsLocalFull r@(Repo { location = Dir _ }) = configAvail r && not (configBare r)
repoIsLocalFull _ = False
assertLocal :: Repo -> a -> a