summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Content.hs13
-rw-r--r--debian/changelog2
-rw-r--r--doc/git-annex.mdwn8
3 files changed, 16 insertions, 7 deletions
diff --git a/Content.hs b/Content.hs
index 596274ad0..39a3addcc 100644
--- a/Content.hs
+++ b/Content.hs
@@ -119,24 +119,23 @@ checkDiskSpace = checkDiskSpace' 0
checkDiskSpace' :: Integer -> Key -> Annex ()
checkDiskSpace' adjustment key = do
- liftIO $ putStrLn $ "adjust " ++ show adjustment
g <- Annex.gitRepo
+ r <- Annex.repoConfig g "diskreserve" ""
+ let reserve = if null r then megabyte else (read r :: Integer)
stats <- liftIO $ getFileSystemStats (gitAnnexDir g)
case (stats, keySize key) of
(Nothing, _) -> return ()
(_, Nothing) -> return ()
(Just (FileSystemStats { fsStatBytesAvailable = have }), Just need) ->
- if (need + overhead >= have + adjustment)
+ if (need + reserve > have + adjustment)
then error $ "not enough free space (have " ++
showsize (have + adjustment) ++ "; need " ++
- showsize (need + overhead) ++ ")"
+ showsize (need + reserve) ++ ")"
else return ()
where
showsize i = show i
- -- Adding a file to the annex requires some overhead beyond
- -- just the file size; the git index must be updated, etc.
- -- This is an arbitrary value.
- overhead = 1024 * 1024 -- 1 mb
+ megabyte :: Integer
+ megabyte = 1024 * 1024
{- Removes the write bits from a file. -}
preventWrite :: FilePath -> IO ()
diff --git a/debian/changelog b/debian/changelog
index e0927817a..88e0986a9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ git-annex (0.20110321) UNRELEASED; urgency=low
with git-annex 0.24 or earlier.) The code is believed to work on
Linux, FreeBSD, and OSX; check compile-time messages to see if it
is not enabled for your OS.
+ * Add annex.diskreserve config setting, to control how much free space
+ to reserve for other purposes and avoid using (defaults to 1 mb).
* Add --fast flag, that can enable less expensive, but also less thurough
versions of some commands.
* fsck: In fast mode, avoid checking checksums.
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index 6168ebae2..3cf408939 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -377,6 +377,14 @@ Here are all the supported configuration settings.
Default ssh and rsync options to use if a remote does not have
specific options.
+* `annex.diskreserve`
+
+ Amount of disk space to reserve. Disk space is checked when transferring
+ content to avoid running out, and additional free space can be reserved
+ via this option, to make space for more important content (such as git
+ commit logs). The units are bytes.
+ The default reserve is 1048576 (1 megabyte).
+
* `annex.version`
Automatically maintained, and used to automate upgrades between versions.