use isBareRepo

The advantage over Git.Config.isBare is that it avoids a string
comparison and a map lookup.

Sponsored-by: Noam Kremen on Patreon
This commit is contained in:
Joey Hess 2023-02-14 13:49:16 -04:00
parent 8077fc9ce7
commit 12b45d3b89
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -52,7 +52,7 @@ import Git.Sha
import Git.CatFile import Git.CatFile
import Git.Branch (writeTreeQuiet, update') import Git.Branch (writeTreeQuiet, update')
import qualified Git.Ref import qualified Git.Ref
import qualified Git.Config import Config
import Config.Smudge import Config.Smudge
import qualified Utility.RawFilePath as R import qualified Utility.RawFilePath as R
@ -176,7 +176,7 @@ getAssociatedFiles k = emptyWhenBare $ runReaderIO AssociatedTable $
- in a bare repository, but it might happen if a non-bare repo got - in a bare repository, but it might happen if a non-bare repo got
- converted to bare. -} - converted to bare. -}
emptyWhenBare :: Annex [a] -> Annex [a] emptyWhenBare :: Annex [a] -> Annex [a]
emptyWhenBare a = ifM (Git.Config.isBare <$> gitRepo) emptyWhenBare a = ifM isBareRepo
( return [] ( return []
, a , a
) )
@ -261,7 +261,7 @@ isInodeKnown i s = or <$> runReaderIO ContentTable
- is an associated file. - is an associated file.
-} -}
reconcileStaged :: Bool -> H.DbQueue -> Annex DbTablesChanged reconcileStaged :: Bool -> H.DbQueue -> Annex DbTablesChanged
reconcileStaged dbisnew qh = ifM (Git.Config.isBare <$> gitRepo) reconcileStaged dbisnew qh = ifM isBareRepo
( return mempty ( return mempty
, do , do
gitindex <- inRepo currentIndexFile gitindex <- inRepo currentIndexFile