directory special remote: Fix checking that there is enough disk space to hold an object, was broken when using encryption.
This commit is contained in:
parent
87169628aa
commit
ca9ac8770f
2 changed files with 10 additions and 8 deletions
|
@ -118,7 +118,7 @@ withStoredFiles = withCheckedFiles doesFileExist
|
||||||
store :: FilePath -> ChunkSize -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
store :: FilePath -> ChunkSize -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
||||||
store d chunksize k _f p = sendAnnex k (void $ remove d k) $ \src ->
|
store d chunksize k _f p = sendAnnex k (void $ remove d k) $ \src ->
|
||||||
metered (Just p) k $ \meterupdate ->
|
metered (Just p) k $ \meterupdate ->
|
||||||
storeHelper d chunksize k $ \dests ->
|
storeHelper d chunksize k k $ \dests ->
|
||||||
case chunksize of
|
case chunksize of
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
let dest = Prelude.head dests
|
let dest = Prelude.head dests
|
||||||
|
@ -132,7 +132,7 @@ store d chunksize k _f p = sendAnnex k (void $ remove d k) $ \src ->
|
||||||
storeEncrypted :: FilePath -> GpgOpts -> ChunkSize -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
storeEncrypted :: FilePath -> GpgOpts -> ChunkSize -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
||||||
storeEncrypted d gpgOpts chunksize (cipher, enck) k p = sendAnnex k (void $ remove d enck) $ \src ->
|
storeEncrypted d gpgOpts chunksize (cipher, enck) k p = sendAnnex k (void $ remove d enck) $ \src ->
|
||||||
metered (Just p) k $ \meterupdate ->
|
metered (Just p) k $ \meterupdate ->
|
||||||
storeHelper d chunksize enck $ \dests ->
|
storeHelper d chunksize enck k $ \dests ->
|
||||||
encrypt gpgOpts cipher (feedFile src) $ readBytes $ \b ->
|
encrypt gpgOpts cipher (feedFile src) $ readBytes $ \b ->
|
||||||
case chunksize of
|
case chunksize of
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
|
@ -173,17 +173,17 @@ storeSplit' meterupdate chunksize (d:dests) bs c = do
|
||||||
feed bytes' (sz - s) ls h
|
feed bytes' (sz - s) ls h
|
||||||
else return (l:ls)
|
else return (l:ls)
|
||||||
|
|
||||||
storeHelper :: FilePath -> ChunkSize -> Key -> ([FilePath] -> IO [FilePath]) -> Annex Bool
|
storeHelper :: FilePath -> ChunkSize -> Key -> Key -> ([FilePath] -> IO [FilePath]) -> Annex Bool
|
||||||
storeHelper d chunksize key storer = check <&&> go
|
storeHelper d chunksize key origkey storer = check <&&> go
|
||||||
where
|
where
|
||||||
tmpdir = tmpDir d key
|
tmpdir = tmpDir d key
|
||||||
destdir = storeDir d key
|
destdir = storeDir d key
|
||||||
{- The size is not exactly known when encrypting the key;
|
{- An encrypted key does not have a known size,
|
||||||
- this assumes that at least the size of the key is
|
- so check that the size of the original key is available as free
|
||||||
- needed as free space. -}
|
- space. -}
|
||||||
check = do
|
check = do
|
||||||
liftIO $ createDirectoryIfMissing True tmpdir
|
liftIO $ createDirectoryIfMissing True tmpdir
|
||||||
checkDiskSpace (Just tmpdir) key 0
|
checkDiskSpace (Just tmpdir) origkey 0
|
||||||
go = liftIO $ catchBoolIO $
|
go = liftIO $ catchBoolIO $
|
||||||
storeChunks key tmpdir destdir chunksize storer recorder finalizer
|
storeChunks key tmpdir destdir chunksize storer recorder finalizer
|
||||||
finalizer tmp dest = do
|
finalizer tmp dest = do
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -20,6 +20,8 @@ git-annex (4.20130710) UNRELEASED; urgency=low
|
||||||
or deleted before it could be scanned.
|
or deleted before it could be scanned.
|
||||||
* watcher: Partially worked around a bug in hinotify, no longer crashes
|
* watcher: Partially worked around a bug in hinotify, no longer crashes
|
||||||
if hinotify cannot process a directory (but can't detect changes in it)
|
if hinotify cannot process a directory (but can't detect changes in it)
|
||||||
|
* directory special remote: Fix checking that there is enough disk space
|
||||||
|
to hold an object, was broken when using encryption.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Tue, 09 Jul 2013 19:17:13 -0400
|
-- Joey Hess <joeyh@debian.org> Tue, 09 Jul 2013 19:17:13 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue