diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-05-12 15:19:08 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-05-12 15:20:22 -0400 |
commit | b94eafec8c4a7868da753f9b22ca823552e9764c (patch) | |
tree | b56d9b021182fa6e143cae726a9417f7233c3752 /Remote/Directory.hs | |
parent | fd33ca1ed6709837bc92d065ff345478e359a7d2 (diff) |
Take space that will be used by running downloads into account when checking annex.diskreserve.
Diffstat (limited to 'Remote/Directory.hs')
-rw-r--r-- | Remote/Directory.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs index 8b727c77e..c0bbcf544 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -118,9 +118,16 @@ tmpDir d k = addTrailingPathSeparator $ d </> "tmp" </> keyFile k {- Check if there is enough free disk space in the remote's directory to - store the key. Note that the unencrypted key size is checked. -} prepareStore :: FilePath -> ChunkConfig -> Preparer Storer -prepareStore d chunkconfig = checkPrepare - (\k -> checkDiskSpace (Just d) k 0) +prepareStore d chunkconfig = checkPrepare checker (byteStorer $ store d chunkconfig) + where + checker k = do + annexdir <- fromRepo gitAnnexObjectDir + samefilesystem <- liftIO $ catchDefaultIO False $ + (\a b -> deviceID a == deviceID b) + <$> getFileStatus d + <*> getFileStatus annexdir + checkDiskSpace (Just d) k 0 samefilesystem store :: FilePath -> ChunkConfig -> Key -> L.ByteString -> MeterUpdate -> Annex Bool store d chunkconfig k b p = liftIO $ do |