aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Threads/Committer.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Assistant/Threads/Committer.hs')
-rw-r--r--Assistant/Threads/Committer.hs25
1 files changed, 13 insertions, 12 deletions
diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs
index 445f4753b..695703e22 100644
--- a/Assistant/Threads/Committer.hs
+++ b/Assistant/Threads/Committer.hs
@@ -112,7 +112,7 @@ waitChangeTime a = waitchanges 0
- that make up a file rename? Or some of the pairs that make up
- a directory rename?
-}
- possiblyrename cs = all renamepart cs
+ possiblyrename = all renamepart
renamepart (PendingAddChange _ _) = True
renamepart c = isRmChange c
@@ -309,7 +309,7 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do
inRepo (Git.LsFiles.notInRepo False $ map changeFile pending)
-- note: timestamp info is lost here
let ts = changeTime exemplar
- return (map (PendingAddChange ts) newfiles, void $ liftIO $ cleanup)
+ return (map (PendingAddChange ts) newfiles, void $ liftIO cleanup)
returnWhen c a
| c = return otherchanges
@@ -317,12 +317,13 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do
add :: Change -> Assistant (Maybe Change)
add change@(InProcessAddChange { keySource = ks }) =
- catchDefaultIO Nothing <~> do
- sanitycheck ks $ do
- (mkey, mcache) <- liftAnnex $ do
- showStart "add" $ keyFilename ks
- Command.Add.ingest $ Just ks
- maybe (failedingest change) (done change mcache $ keyFilename ks) mkey
+ catchDefaultIO Nothing <~> doadd
+ where
+ doadd = sanitycheck ks $ do
+ (mkey, mcache) <- liftAnnex $ do
+ showStart "add" $ keyFilename ks
+ Command.Add.ingest $ Just ks
+ maybe (failedingest change) (done change mcache $ keyFilename ks) mkey
add _ = return Nothing
{- In direct mode, avoid overhead of re-injesting a renamed
@@ -371,7 +372,7 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do
( inRepo $ gitAnnexLink file key
, Command.Add.link file key mcache
)
- whenM (pure DirWatcher.eventsCoalesce <||> isDirect) $ do
+ whenM (pure DirWatcher.eventsCoalesce <||> isDirect) $
stageSymlink file =<< hashSymlink link
showEndOk
return $ Just $ finishedChange change key
@@ -415,8 +416,8 @@ safeToAdd _ [] [] = return []
safeToAdd delayadd pending inprocess = do
maybe noop (liftIO . threadDelaySeconds) delayadd
liftAnnex $ do
- keysources <- mapM Command.Add.lockDown (map changeFile pending)
- let inprocess' = inprocess ++ catMaybes (map mkinprocess $ zip pending keysources)
+ keysources <- forM pending $ Command.Add.lockDown . changeFile
+ let inprocess' = inprocess ++ mapMaybe mkinprocess (zip pending keysources)
openfiles <- S.fromList . map fst3 . filter openwrite <$>
findopenfiles (map keySource inprocess')
let checked = map (check openfiles) inprocess'
@@ -434,7 +435,7 @@ safeToAdd delayadd pending inprocess = do
| S.member (contentLocation ks) openfiles = Left change
check _ change = Right change
- mkinprocess (c, Just ks) = Just $ InProcessAddChange
+ mkinprocess (c, Just ks) = Just InProcessAddChange
{ changeTime = changeTime c
, keySource = ks
}