optimise handling of unavailable repos
The exception handling resulted in git config --list being run twice for unavailable repos. This dials it back down to running it only once.
This commit is contained in:
parent
63be8f9d0f
commit
cdf61071bc
1 changed files with 6 additions and 7 deletions
|
@ -191,10 +191,8 @@ tryGitConfigRead r
|
|||
| Git.repoIsHttp r = store geturlconfig
|
||||
| Git.GCrypt.isEncrypted r = handlegcrypt =<< getConfigMaybe (remoteConfig r "uuid")
|
||||
| Git.repoIsUrl r = return r
|
||||
| otherwise = store $ liftIO $
|
||||
readlocalannexconfig
|
||||
`catchNonAsync` (const $ Git.Config.read r)
|
||||
`catchNonAsync` (const $ return r)
|
||||
| otherwise = store $ liftIO $
|
||||
readlocalannexconfig `catchNonAsync` (const $ return r)
|
||||
where
|
||||
haveconfig = not . M.null . Git.config
|
||||
|
||||
|
@ -276,13 +274,14 @@ 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. -}
|
||||
{- The local repo may not yet be initialized, so try to initialize
|
||||
- it if allowed. However, if that fails, still return the read
|
||||
- git config. -}
|
||||
readlocalannexconfig = do
|
||||
s <- Annex.new r
|
||||
Annex.eval s $ do
|
||||
Annex.BranchState.disableUpdate
|
||||
ensureInitialized
|
||||
void $ tryAnnex $ ensureInitialized
|
||||
Annex.getState Annex.repo
|
||||
|
||||
{- Checks if a given remote has the content for a key inAnnex.
|
||||
|
|
Loading…
Add table
Reference in a new issue