summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex/Content.hs24
-rw-r--r--debian/changelog2
2 files changed, 15 insertions, 11 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 9d70ccee3..bbf87880b 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -280,17 +280,19 @@ withTmp key action = do
{- Checks that there is disk space available to store a given key,
- in a destination (or the annex) printing a warning if not. -}
checkDiskSpace :: Maybe FilePath -> Key -> Integer -> Annex Bool
-checkDiskSpace destination key alreadythere = do
- reserve <- annexDiskReserve <$> Annex.getGitConfig
- free <- liftIO . getDiskFree =<< dir
- force <- Annex.getState Annex.force
- case (free, keySize key) of
- (Just have, Just need) -> do
- let ok = (need + reserve <= have + alreadythere) || force
- unless ok $
- needmorespace (need + reserve - have - alreadythere)
- return ok
- _ -> return True
+checkDiskSpace destination key alreadythere = ifM (Annex.getState Annex.force)
+ ( return True
+ , do
+ reserve <- annexDiskReserve <$> Annex.getGitConfig
+ free <- liftIO . getDiskFree =<< dir
+ case (free, fromMaybe 1 (keySize key)) of
+ (Just have, need) -> do
+ let ok = (need + reserve <= have + alreadythere)
+ unless ok $
+ needmorespace (need + reserve - have - alreadythere)
+ return ok
+ _ -> return True
+ )
where
dir = maybe (fromRepo gitAnnexDir) return destination
needmorespace n =
diff --git a/debian/changelog b/debian/changelog
index 5f62dc62c..8bbadfea2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,8 @@ git-annex (5.20150410) UNRELEASED; urgency=medium
* bittorrent: Fix handling of magnet links.
* Windows: Fixed support of remotes on other drives.
(A reversion introduced in version 5.20150113.)
+ * When a key's size is unknown, still check the annex.diskreserve,
+ and avoid getting content if the disk is too full.
-- Joey Hess <id@joeyh.name> Thu, 09 Apr 2015 20:59:43 -0400