aboutsummaryrefslogtreecommitdiff
path: root/Annex/Content.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-29 23:10:18 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-29 23:10:18 -0400
commit652f844e2348165062868cb197ee725d42198f03 (patch)
tree2d6a26a3659e54428fdf893bc9919ffb0b6de5de /Annex/Content.hs
parent69650c5989432cd83067614421c6bc3ef0cccab7 (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 'Annex/Content.hs')
-rw-r--r--Annex/Content.hs8
1 files changed, 2 insertions, 6 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 54e019345..1f7516fe1 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -35,7 +35,6 @@ import System.IO.Unsafe (unsafeInterleaveIO)
import Common.Annex
import Logs.Location
import qualified Git
-import qualified Git.Config
import qualified Annex
import qualified Annex.Queue
import qualified Annex.Branch
@@ -188,7 +187,7 @@ withTmp key action = do
- in a destination (or the annex) printing a warning if not. -}
checkDiskSpace :: Maybe FilePath -> Key -> Integer -> Annex Bool
checkDiskSpace destination key alreadythere = do
- reserve <- getDiskReserve
+ reserve <- annexDiskReserve <$> Annex.getConfig
free <- liftIO . getDiskFree =<< dir
force <- Annex.getState Annex.force
case (free, keySize key) of
@@ -396,11 +395,8 @@ saveState :: Bool -> Annex ()
saveState nocommit = doSideAction $ do
Annex.Queue.flush
unless nocommit $
- whenM alwayscommit $
+ whenM (annexAlwaysCommit <$> Annex.getConfig) $
Annex.Branch.commit "update"
- where
- alwayscommit = fromMaybe True . Git.Config.isTrue
- <$> getConfig (annexConfig "alwayscommit") ""
{- Downloads content from any of a list of urls. -}
downloadUrl :: [Url.URLString] -> FilePath -> Annex Bool