summaryrefslogtreecommitdiff
path: root/Config.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-03-22 17:09:54 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-03-22 17:32:47 -0400
commite38a839a80ae70eba13b6fd0e7ee08be8a62c513 (patch)
treec6f3faf1df29c0d9ddf7458554661ee4e50c9aed /Config.hs
parentf1398b558316a936690a8f3b01493f498d15b659 (diff)
Rewrote free disk space checking code
Moving the portability handling into a small C library cleans up things a lot, avoiding the pain of unpacking structs from inside haskell code.
Diffstat (limited to 'Config.hs')
-rw-r--r--Config.hs18
1 files changed, 3 insertions, 15 deletions
diff --git a/Config.hs b/Config.hs
index f20298485..10a66e47b 100644
--- a/Config.hs
+++ b/Config.hs
@@ -12,7 +12,6 @@ import qualified Git
import qualified Git.Config
import qualified Git.Command
import qualified Annex
-import qualified Build.SysConfig
import Utility.DataUnits
type ConfigKey = String
@@ -92,19 +91,8 @@ getTrustLevel :: Git.Repo -> Annex (Maybe String)
getTrustLevel r = fromRepo $ Git.Config.getMaybe $ remoteConfig r "trustlevel"
{- Gets annex.diskreserve setting. -}
-getDiskReserve :: Bool -> Annex Integer
-getDiskReserve sanitycheck = do
- r <- getConfig "diskreserve" ""
- when sanitycheck $ check r
- return $ fromMaybe megabyte $ readSize dataUnits r
+getDiskReserve :: Annex Integer
+getDiskReserve = fromMaybe megabyte . readSize dataUnits
+ <$> getConfig "diskreserve" ""
where
megabyte = 1000000
- check r
- | not (null r) && not cancheck = do
- unlessM (Annex.getState Annex.force) $
- error $ "You have configured a diskreserve of "
- ++ r ++
- " but disk space checking is not working"
- return ()
- | otherwise = return ()
- cancheck = Build.SysConfig.statfs_sanity_checked == Just True