From 68d90b3328f7b8e7c9aa0bd997bef20724d7cafc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 23 Mar 2011 12:45:34 -0400 Subject: [PATCH] allow force overriding the disk space check --- Content.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Content.hs b/Content.hs index bc43e4b443..633d827e6f 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 ()