aboutsummaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
Diffstat (limited to 'Command')
-rw-r--r--Command/Add.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index 7100006c6..343ffbe95 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -125,11 +125,7 @@ ingest (Just source) = do
godirect (Just (key, _)) (Just cache) = do
writeInodeCache key cache
- void $ addAssociatedFile key $ keyFilename source
- unlessM crippledFileSystem $
- liftIO $ allowWrite $ keyFilename source
- when (contentLocation source /= keyFilename source) $
- liftIO $ nukeFile $ contentLocation source
+ finishIngestDirect key source
return $ Just key
godirect _ _ = failure
@@ -138,6 +134,14 @@ ingest (Just source) = do
liftIO $ nukeFile $ contentLocation source
return Nothing
+finishIngestDirect :: Key -> KeySource -> Annex ()
+finishIngestDirect key source = do
+ void $ addAssociatedFile key $ keyFilename source
+ unlessM crippledFileSystem $
+ liftIO $ allowWrite $ keyFilename source
+ when (contentLocation source /= keyFilename source) $
+ liftIO $ nukeFile $ contentLocation source
+
perform :: FilePath -> CommandPerform
perform file =
maybe stop (\key -> next $ cleanup file key True)