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.repoIsHttp r = store geturlconfig
|
||||||
| Git.GCrypt.isEncrypted r = handlegcrypt =<< getConfigMaybe (remoteConfig r "uuid")
|
| Git.GCrypt.isEncrypted r = handlegcrypt =<< getConfigMaybe (remoteConfig r "uuid")
|
||||||
| Git.repoIsUrl r = return r
|
| Git.repoIsUrl r = return r
|
||||||
| otherwise = store $ liftIO $
|
| otherwise = store $ liftIO $
|
||||||
readlocalannexconfig
|
readlocalannexconfig `catchNonAsync` (const $ return r)
|
||||||
`catchNonAsync` (const $ Git.Config.read r)
|
|
||||||
`catchNonAsync` (const $ return r)
|
|
||||||
where
|
where
|
||||||
haveconfig = not . M.null . Git.config
|
haveconfig = not . M.null . Git.config
|
||||||
|
|
||||||
|
@ -276,13 +274,14 @@ tryGitConfigRead r
|
||||||
Just v -> store $ liftIO $ setUUID r $
|
Just v -> store $ liftIO $ setUUID r $
|
||||||
genUUIDInNameSpace gCryptNameSpace v
|
genUUIDInNameSpace gCryptNameSpace v
|
||||||
|
|
||||||
{- Throws an exception if the remote is not already initialied
|
{- The local repo may not yet be initialized, so try to initialize
|
||||||
- or cannot be automatically initialized. -}
|
- it if allowed. However, if that fails, still return the read
|
||||||
|
- git config. -}
|
||||||
readlocalannexconfig = do
|
readlocalannexconfig = do
|
||||||
s <- Annex.new r
|
s <- Annex.new r
|
||||||
Annex.eval s $ do
|
Annex.eval s $ do
|
||||||
Annex.BranchState.disableUpdate
|
Annex.BranchState.disableUpdate
|
||||||
ensureInitialized
|
void $ tryAnnex $ ensureInitialized
|
||||||
Annex.getState Annex.repo
|
Annex.getState Annex.repo
|
||||||
|
|
||||||
{- Checks if a given remote has the content for a key inAnnex.
|
{- Checks if a given remote has the content for a key inAnnex.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue