summaryrefslogtreecommitdiff
path: root/Logs/Transfer.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Logs/Transfer.hs')
-rw-r--r--Logs/Transfer.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs
index 6d6d3d890..c6f240be0 100644
--- a/Logs/Transfer.hs
+++ b/Logs/Transfer.hs
@@ -115,7 +115,7 @@ runTransfer t file shouldretry a = do
mode <- annexFileMode
ok <- retry info metervar $
bracketIO (prep tfile mode info) (cleanup tfile) (a meter)
- unless ok $ failed info
+ unless ok $ recordFailedTransfer t info
return ok
where
prep tfile mode info = catchMaybeIO $ do
@@ -132,10 +132,6 @@ runTransfer t file shouldretry a = do
void $ tryIO $ removeFile tfile
void $ tryIO $ removeFile $ transferLockFile tfile
closeFd fd
- failed info = do
- failedtfile <- fromRepo $ failedTransferFile t
- createAnnexDirectory $ takeDirectory failedtfile
- liftIO $ writeTransferInfoFile info failedtfile
retry oldinfo metervar run = do
v <- tryAnnex run
case v of
@@ -236,6 +232,12 @@ removeFailedTransfer t = do
f <- fromRepo $ failedTransferFile t
liftIO $ void $ tryIO $ removeFile f
+recordFailedTransfer :: Transfer -> TransferInfo -> Annex ()
+recordFailedTransfer t info = do
+ failedtfile <- fromRepo $ failedTransferFile t
+ createAnnexDirectory $ takeDirectory failedtfile
+ liftIO $ writeTransferInfoFile info failedtfile
+
{- The transfer information file to use for a given Transfer. -}
transferFile :: Transfer -> Git.Repo -> FilePath
transferFile (Transfer direction u key) r = transferDir direction r