use file-io for readFile/writeFile/appendFile on ByteStrings
These are all straightforward, and easy small performance wins. Sponsored-by: Nicholas Golder-Manning
This commit is contained in:
parent
90cd3aad37
commit
9b79f0f43d
19 changed files with 63 additions and 52 deletions
|
@ -32,6 +32,7 @@ import Annex.SpecialRemote.Config (exportTreeField)
|
|||
import Remote.Helper.Chunked
|
||||
import Remote.Helper.Encryptable (encryptionField, highRandomQualityField)
|
||||
import Git.Types
|
||||
import qualified Utility.FileIO as F
|
||||
|
||||
import Test.Tasty
|
||||
import Test.Tasty.Runners
|
||||
|
@ -255,18 +256,18 @@ test runannex mkr mkk =
|
|||
get r k
|
||||
, check "fsck downloaded object" fsck
|
||||
, check "retrieveKeyFile resume from 0" $ \r k -> do
|
||||
tmp <- fromRawFilePath <$> prepTmp k
|
||||
liftIO $ writeFile tmp ""
|
||||
tmp <- toOsPath <$> prepTmp k
|
||||
liftIO $ F.writeFile' tmp mempty
|
||||
lockContentForRemoval k noop removeAnnex
|
||||
get r k
|
||||
, check "fsck downloaded object" fsck
|
||||
, check "retrieveKeyFile resume from 33%" $ \r k -> do
|
||||
loc <- fromRawFilePath <$> Annex.calcRepo (gitAnnexLocation k)
|
||||
tmp <- fromRawFilePath <$> prepTmp k
|
||||
tmp <- toOsPath <$> prepTmp k
|
||||
partial <- liftIO $ bracket (openBinaryFile loc ReadMode) hClose $ \h -> do
|
||||
sz <- hFileSize h
|
||||
L.hGet h $ fromInteger $ sz `div` 3
|
||||
liftIO $ L.writeFile tmp partial
|
||||
liftIO $ F.writeFile tmp partial
|
||||
lockContentForRemoval k noop removeAnnex
|
||||
get r k
|
||||
, check "fsck downloaded object" fsck
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue