diff options
author | Joey Hess <joey@kitenet.net> | 2012-12-29 23:10:18 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-12-29 23:10:18 -0400 |
commit | 652f844e2348165062868cb197ee725d42198f03 (patch) | |
tree | 2d6a26a3659e54428fdf893bc9919ffb0b6de5de /Command | |
parent | 69650c5989432cd83067614421c6bc3ef0cccab7 (diff) |
type based git config handling
Now there's a Config type, that's extracted from the git config at startup.
Note that laziness means that individual config values are only looked up
and parsed on demand, and so we get implicit memoization for all of them.
So this is not only prettier and more type safe, it optimises several
places that didn't have explicit memoization before. As well as getting rid
of the ugly explicit memoization code.
Not yet done for annex.<remote>.* configuration settings.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Status.hs | 2 | ||||
-rw-r--r-- | Command/Unused.hs | 7 |
2 files changed, 3 insertions, 6 deletions
diff --git a/Command/Status.hs b/Command/Status.hs index d2307798f..9c5e3e70a 100644 --- a/Command/Status.hs +++ b/Command/Status.hs @@ -200,7 +200,7 @@ transfer_list = stat "transfers in progress" $ nojson $ lift $ do disk_size :: Stat disk_size = stat "available local disk space" $ json id $ lift $ calcfree - <$> getDiskReserve + <$> (annexDiskReserve <$> Annex.getConfig) <*> inRepo (getDiskFree . gitAnnexDir) where calcfree reserve (Just have) = unwords diff --git a/Command/Unused.hs b/Command/Unused.hs index c0551ddea..2823ccefd 100644 --- a/Command/Unused.hs +++ b/Command/Unused.hs @@ -22,7 +22,6 @@ import Logs.Unused import Annex.Content import Utility.FileMode import Logs.Location -import Config import qualified Annex import qualified Git import qualified Git.Command @@ -181,11 +180,9 @@ exclude smaller larger = S.toList $ remove larger $ S.fromList smaller - so will easily fit on even my lowest memory systems. -} bloomCapacity :: Annex Int -bloomCapacity = fromMaybe 500000 . readish - <$> getConfig (annexConfig "bloomcapacity") "" +bloomCapacity = fromMaybe 500000 . annexBloomCapacity <$> Annex.getConfig bloomAccuracy :: Annex Int -bloomAccuracy = fromMaybe 1000 . readish - <$> getConfig (annexConfig "bloomaccuracy") "" +bloomAccuracy = fromMaybe 1000 . annexBloomAccuracy <$> Annex.getConfig bloomBitsHashes :: Annex (Int, Int) bloomBitsHashes = do capacity <- bloomCapacity |