unify batch mode with non-batch by using AnnexedFileSeeker

This commit is contained in:
Joey Hess 2020-07-22 14:23:28 -04:00
parent d9ae6ab0b4
commit 1be92381ec
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
23 changed files with 70 additions and 74 deletions

View file

@ -44,12 +44,13 @@ import qualified Annex.BranchState
import qualified Database.Keys
import qualified Utility.RawFilePath as R
import Utility.Tuple
import CmdLine.Action
import Control.Concurrent.Async
import System.Posix.Types
data AnnexedFileSeeker = AnnexedFileSeeker
{ seekAction :: RawFilePath -> Key -> CommandSeek
{ startAction :: RawFilePath -> Key -> CommandStart
, checkContentPresent :: Maybe Bool
, usesLocationLog :: Bool
}
@ -305,7 +306,8 @@ seekFilteredKeys seeker listfs = do
Just (f, content) -> do
case parseLinkTargetOrPointerLazy =<< content of
Just k -> checkpresence k $
seekAction seeker f k
commandAction $
startAction seeker f k
Nothing -> noop
finisher oreader
Nothing -> return ()
@ -313,7 +315,7 @@ seekFilteredKeys seeker listfs = do
precachefinisher lreader = liftIO lreader >>= \case
Just ((logf, f, k), logcontent) -> do
maybe noop (Annex.BranchState.setCache logf) logcontent
seekAction seeker f k
commandAction $ startAction seeker f k
precachefinisher lreader
Nothing -> return ()