move several readonly values to AnnexRead

This improves performance to a small extent in several places.

Sponsored-by: Tobias Ammann on Patreon
This commit is contained in:
Joey Hess 2022-06-28 15:28:14 -04:00
parent 4174ee33a4
commit cb9cf30c48
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
42 changed files with 81 additions and 88 deletions

View file

@ -44,7 +44,7 @@ defaultBackend = maybe cache return =<< Annex.getState Annex.backend
where
cache = do
n <- maybe (annexBackend <$> Annex.getGitConfig) (return . Just)
=<< Annex.getState Annex.forcebackend
=<< Annex.getRead Annex.forcebackend
b <- case n of
Just name | valid name -> lookupname name
_ -> pure (Prelude.head builtinList)
@ -79,7 +79,7 @@ unknownBackendVarietyMessage v =
- That can be configured on a per-file basis in the gitattributes file,
- or forced with --backend. -}
chooseBackend :: RawFilePath -> Annex (Maybe Backend)
chooseBackend f = Annex.getState Annex.forcebackend >>= go
chooseBackend f = Annex.getRead Annex.forcebackend >>= go
where
go Nothing = maybeLookupBackendVariety . parseKeyVariety . encodeBS
=<< checkAttr "annex.backend" f