free space checking

Free space checking is now done, for transfers of data for keys that have free space metadata.
(Notably, not for SHA* keys generated 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.
This commit is contained in:
Joey Hess 2011-03-22 17:27:04 -04:00
parent aa1bc31e0a
commit aa2d8e33df
6 changed files with 69 additions and 2 deletions

View file

@ -55,7 +55,7 @@ perform file oldkey newbackend = do
case stored of
Nothing -> return Nothing
Just (newkey, _) -> do
ok <- getViaTmp newkey $ \t -> do
ok <- getViaTmpUnchecked newkey $ \t -> do
-- Make a hard link to the old backend's
-- cached key, to avoid wasting disk space.
liftIO $ createLink src t

View file

@ -32,7 +32,8 @@ perform :: FilePath -> CommandPerform
perform file = do
key <- cmdlineKey
-- the file might be on a different filesystem, so mv is used
-- rather than simply calling moveToObjectDir
-- rather than simply calling moveToObjectDir; disk space is also
-- checked this way.
ok <- getViaTmp key $ \dest -> do
if dest /= file
then liftIO $

View file

@ -41,6 +41,8 @@ perform dest key = do
inbackend <- Backend.hasKey key
when (not inbackend) $
error "content not present"
checkDiskSpace key
g <- Annex.gitRepo
let src = gitAnnexLocation g key