aboutsummaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-11 14:14:45 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-11 14:14:45 -0400
commit454fd01fb7ea8b23a46849cdc6982f77064593cf (patch)
tree5e3af481f074c8a37b47834ec342d41301727c8d /Command
parent893860527ee8044cf990abaf03bf0405ff1ddd53 (diff)
finish fast direct mode rename handling. wow, it's fast
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)