summaryrefslogtreecommitdiff
path: root/Remote/Git.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Remote/Git.hs')
-rw-r--r--Remote/Git.hs22
1 files changed, 11 insertions, 11 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs
index 5dcd3bf15..6308f5cd6 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -191,20 +191,11 @@ tryGitConfigRead r
| Git.repoIsHttp r = store geturlconfig
| Git.GCrypt.isEncrypted r = handlegcrypt =<< getConfigMaybe (remoteConfig r "uuid")
| Git.repoIsUrl r = return r
- | otherwise = store $ safely $ do
- s <- Annex.new r
- Annex.eval s $ do
- Annex.BranchState.disableUpdate
- ensureInitialized
- Annex.getState Annex.repo
+ | otherwise = store $ liftIO $
+ readlocalannexconfig `catchNonAsync` (const $ Git.Config.read r)
where
haveconfig = not . M.null . Git.config
- -- Reading config can fail due to IO error or
- -- for other reasons; catch all possible exceptions.
- safely a = either (const $ return r) return
- =<< liftIO (try a :: IO (Either SomeException Git.Repo))
-
pipedconfig cmd params = do
v <- Git.Config.fromPipe r cmd params
case v of
@@ -283,6 +274,15 @@ tryGitConfigRead r
Just v -> store $ liftIO $ setUUID r $
genUUIDInNameSpace gCryptNameSpace v
+ {- Throws an exception if the remote is not already initialied
+ - or cannot be automatically initialized. -}
+ readlocalannexconfig = do
+ s <- Annex.new r
+ Annex.eval s $ do
+ Annex.BranchState.disableUpdate
+ ensureInitialized
+ Annex.getState Annex.repo
+
{- Checks if a given remote has the content for a key inAnnex.
- If the remote cannot be accessed, or if it cannot determine
- whether it has the content, returns a Left error message.