diff options
author | 2012-03-21 21:55:02 -0400 | |
---|---|---|
committer | 2012-03-21 21:55:02 -0400 | |
commit | 188e2edc41551fa145d6cb8b36838fcb85132088 (patch) | |
tree | a0f99daac3b86c5b886779aed5cad95729d65684 /Annex/Content.hs | |
parent | 181d2ccd20a41b1785569acb3efb76deb8cbdf00 (diff) |
status: Prints available local disk space, or shows if git-annex doesn't know.
Diffstat (limited to 'Annex/Content.hs')
-rw-r--r-- | Annex/Content.hs | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs index 6bf5391df..1794fb5d9 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -177,11 +177,8 @@ checkDiskSpace = checkDiskSpace' 0 checkDiskSpace' :: Integer -> Key -> Annex () checkDiskSpace' adjustment key = do - g <- gitRepo - r <- getConfig g "diskreserve" "" - sanitycheck r - let reserve = fromMaybe megabyte $ readSize dataUnits r - stats <- liftIO $ getFileSystemStats (gitAnnexDir g) + reserve <- getDiskReserve True + stats <- inRepo $ getFileSystemStats .gitAnnexDir case (cancheck, stats, keySize key) of (False, _, _) -> return () (_, Nothing, _) -> return () @@ -190,22 +187,11 @@ checkDiskSpace' adjustment key = do when (need + reserve > have + adjustment) $ needmorespace (need + reserve - have - adjustment) where - megabyte :: Integer - megabyte = 1000000 needmorespace n = unlessM (Annex.getState Annex.force) $ error $ "not enough free space, need " ++ roughSize storageUnits True n ++ " more" ++ forcemsg forcemsg = " (use --force to override this check or adjust annex.diskreserve)" - sanitycheck 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" - ++ forcemsg - return () - | otherwise = return () cancheck = Build.SysConfig.statfs_sanity_checked == Just True {- Moves a file into .git/annex/objects/ |