finish fast direct mode rename handling. wow, it's fast
This commit is contained in:
parent
87cba71d5a
commit
06046a0d2b
2 changed files with 24 additions and 22 deletions
|
@ -266,14 +266,13 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do
|
||||||
Just cache ->
|
Just cache ->
|
||||||
case M.lookup (inodeCacheToKey ct cache) m of
|
case M.lookup (inodeCacheToKey ct cache) m of
|
||||||
Nothing -> add c
|
Nothing -> add c
|
||||||
Just k -> fastadd c k cache
|
Just k -> fastadd c k
|
||||||
|
|
||||||
fastadd :: Change -> Key -> InodeCache -> Assistant (Maybe Change)
|
fastadd :: Change -> Key -> Assistant (Maybe Change)
|
||||||
fastadd change key cache = do
|
fastadd change key = do
|
||||||
-- TODO do fast method
|
let source = keySource change
|
||||||
debug ["rename detected", show change, show key, show cache]
|
liftAnnex $ Command.Add.finishIngestDirect key source
|
||||||
add change
|
done change (keyFilename source) key
|
||||||
--return $ Just $ finishedChange change key
|
|
||||||
|
|
||||||
removedKeysMap :: InodeComparisonType -> [Change] -> Annex (M.Map InodeCacheKey Key)
|
removedKeysMap :: InodeComparisonType -> [Change] -> Annex (M.Map InodeCacheKey Key)
|
||||||
removedKeysMap ct l = do
|
removedKeysMap ct l = do
|
||||||
|
@ -291,16 +290,15 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do
|
||||||
liftAnnex showEndFail
|
liftAnnex showEndFail
|
||||||
return Nothing
|
return Nothing
|
||||||
|
|
||||||
done change file key = do
|
done change file key = liftAnnex $ do
|
||||||
liftAnnex $ do
|
logStatus key InfoPresent
|
||||||
logStatus key InfoPresent
|
link <- ifM isDirect
|
||||||
link <- ifM isDirect
|
( calcGitLink file key
|
||||||
( calcGitLink file key
|
, Command.Add.link file key True
|
||||||
, Command.Add.link file key True
|
)
|
||||||
)
|
whenM (pure DirWatcher.eventsCoalesce <||> isDirect) $ do
|
||||||
whenM (pure DirWatcher.eventsCoalesce <||> isDirect) $ do
|
stageSymlink file =<< hashSymlink link
|
||||||
stageSymlink file =<< hashSymlink link
|
showEndOk
|
||||||
showEndOk
|
|
||||||
return $ Just $ finishedChange change key
|
return $ Just $ finishedChange change key
|
||||||
|
|
||||||
{- Check that the keysource's keyFilename still exists,
|
{- Check that the keysource's keyFilename still exists,
|
||||||
|
|
|
@ -125,11 +125,7 @@ ingest (Just source) = do
|
||||||
|
|
||||||
godirect (Just (key, _)) (Just cache) = do
|
godirect (Just (key, _)) (Just cache) = do
|
||||||
writeInodeCache key cache
|
writeInodeCache key cache
|
||||||
void $ addAssociatedFile key $ keyFilename source
|
finishIngestDirect key source
|
||||||
unlessM crippledFileSystem $
|
|
||||||
liftIO $ allowWrite $ keyFilename source
|
|
||||||
when (contentLocation source /= keyFilename source) $
|
|
||||||
liftIO $ nukeFile $ contentLocation source
|
|
||||||
return $ Just key
|
return $ Just key
|
||||||
godirect _ _ = failure
|
godirect _ _ = failure
|
||||||
|
|
||||||
|
@ -138,6 +134,14 @@ ingest (Just source) = do
|
||||||
liftIO $ nukeFile $ contentLocation source
|
liftIO $ nukeFile $ contentLocation source
|
||||||
return Nothing
|
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 :: FilePath -> CommandPerform
|
||||||
perform file =
|
perform file =
|
||||||
maybe stop (\key -> next $ cleanup file key True)
|
maybe stop (\key -> next $ cleanup file key True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue