From c2dd2a28a55709d598fef4e05ac7bfd6291479b5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 12 Sep 2017 14:19:26 -0400 Subject: leave export logged as incomplete if initial renames fail This way, the temp files that might be left due to failure will be cleaned up next time. Also, nub the list of incomplete exports to avoid repeatedly adding the same tree to it when running export repeatedly when it's failing. This commit was supported by the NSF-funded DataLad project. --- Command/Export.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Command') diff --git a/Command/Export.hs b/Command/Export.hs index 52355e69d..8f1a6f149 100644 --- a/Command/Export.hs +++ b/Command/Export.hs @@ -10,6 +10,7 @@ module Command.Export where import Command +import qualified Annex import qualified Git import qualified Git.DiffTree import qualified Git.LsTree @@ -144,10 +145,12 @@ seek o = do -- Waiting until now to record the export guarantees that, -- if this export is interrupted, there are no files left over -- from a previous export, that are not part of this export. - recordExport (uuid r) $ ExportChange - { oldTreeish = map exportedTreeish old - , newTreeish = new - } + c <- Annex.getState Annex.errcounter + when (c == 0) $ + recordExport (uuid r) $ ExportChange + { oldTreeish = map exportedTreeish old + , newTreeish = new + } -- Export everything that is not yet exported. (l, cleanup') <- inRepo $ Git.LsTree.lsTree new -- cgit v1.2.3