finish fast direct mode rename handling. wow, it's fast

This commit is contained in:
Joey Hess 2013-03-11 14:14:45 -04:00
parent 87cba71d5a
commit 06046a0d2b
2 changed files with 24 additions and 22 deletions

View file

@ -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)