summaryrefslogtreecommitdiff
path: root/Content.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-03-23 12:45:34 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-03-23 12:45:34 -0400
commit68d90b3328f7b8e7c9aa0bd997bef20724d7cafc (patch)
treef7f78932b686a31e6ba16937608a8a7268c82e7e /Content.hs
parente096c8278a6f1ca313538564018574731282b43a (diff)
allow force overriding the disk space check
Diffstat (limited to 'Content.hs')
-rw-r--r--Content.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/Content.hs b/Content.hs
index bc43e4b44..633d827e6 100644
--- a/Content.hs
+++ b/Content.hs
@@ -129,13 +129,17 @@ checkDiskSpace' adjustment key = do
(_, Nothing) -> return ()
(Just (FileSystemStats { fsStatBytesAvailable = have }), Just need) ->
if (need + reserve > have + adjustment)
- then error $ "not enough free space, need " ++
- roughSize True (need + reserve - have - adjustment) ++
- " more"
+ then needmorespace (need + reserve - have - adjustment)
else return ()
where
megabyte :: Integer
megabyte = 1024 * 1024
+ needmorespace n = do
+ force <- Annex.getState Annex.force
+ unless force $
+ error $ "not enough free space, need " ++
+ roughSize True n ++
+ " more (use --force to override this check or adjust annex.diskreserve)"
{- Removes the write bits from a file. -}
preventWrite :: FilePath -> IO ()