diff options
author | Joey Hess <joey@kitenet.net> | 2011-03-26 14:37:39 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-03-26 14:37:39 -0400 |
commit | 8bcdf42b99675d507813205f097ab7b64b30f514 (patch) | |
tree | 0c489557e80de0ae1dd86e6cc0ca102a3d67dc14 /Content.hs | |
parent | ceb9593a9cbd39b00daf57ce52724eb40d85f1e0 (diff) |
annex.diskreserve can be given in arbitrary units (ie "0.5 gigabytes")
Diffstat (limited to 'Content.hs')
-rw-r--r-- | Content.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Content.hs b/Content.hs index 633d827e6..7aa30f7ff 100644 --- a/Content.hs +++ b/Content.hs @@ -122,7 +122,9 @@ checkDiskSpace' :: Integer -> Key -> Annex () checkDiskSpace' adjustment key = do g <- Annex.gitRepo r <- Annex.repoConfig g "diskreserve" "" - let reserve = if null r then megabyte else (read r :: Integer) + let reserve = case readSize dataUnits r of + Nothing -> megabyte + Just v -> v stats <- liftIO $ getFileSystemStats (gitAnnexDir g) case (stats, keySize key) of (Nothing, _) -> return () @@ -133,12 +135,12 @@ checkDiskSpace' adjustment key = do else return () where megabyte :: Integer - megabyte = 1024 * 1024 + megabyte = 1000000 needmorespace n = do force <- Annex.getState Annex.force unless force $ error $ "not enough free space, need " ++ - roughSize True n ++ + roughSize storageUnits True n ++ " more (use --force to override this check or adjust annex.diskreserve)" {- Removes the write bits from a file. -} |