summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-11-05 18:21:48 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-11-05 18:21:48 -0400
commita2c9cbbdc4047b799321ec388a94d4f96951a6f2 (patch)
tree5dc73f5fca4209147b66cbb3b5d471b278e5ced4 /Annex
parente0d5901349c15b3eeace319cbe8854e655a602d6 (diff)
merge git command queue when joining with concurrent thread
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Concurrent.hs2
-rw-r--r--Annex/Queue.hs14
2 files changed, 15 insertions, 1 deletions
diff --git a/Annex/Concurrent.hs b/Annex/Concurrent.hs
index 5faa98a47..787c3e446 100644
--- a/Annex/Concurrent.hs
+++ b/Annex/Concurrent.hs
@@ -12,6 +12,7 @@ import Annex
import Annex.CatFile
import Annex.CheckAttr
import Annex.CheckIgnore
+import qualified Annex.Queue
import qualified Data.Map as M
@@ -57,6 +58,7 @@ mergeState st = do
st' <- liftIO $ snd <$> run st closehandles
forM_ (M.toList $ Annex.cleanup st') $
uncurry addCleanup
+ Annex.Queue.mergeFrom st'
changeState $ \s -> s { errcounter = errcounter s + errcounter st' }
where
closehandles = do
diff --git a/Annex/Queue.hs b/Annex/Queue.hs
index 47837e2d9..136e36093 100644
--- a/Annex/Queue.hs
+++ b/Annex/Queue.hs
@@ -5,12 +5,15 @@
- Licensed under the GNU GPL version 3 or higher.
-}
+{-# LANGUAGE BangPatterns #-}
+
module Annex.Queue (
addCommand,
addUpdateIndex,
flush,
flushWhenFull,
- size
+ size,
+ mergeFrom,
) where
import Common.Annex
@@ -60,3 +63,12 @@ new = do
store :: Git.Queue.Queue -> Annex ()
store q = changeState $ \s -> s { repoqueue = Just q }
+
+mergeFrom :: AnnexState -> Annex ()
+mergeFrom st = case repoqueue st of
+ Nothing -> noop
+ Just newq -> do
+ q <- get
+ let !q' = Git.Queue.merge q newq
+ store q'
+ flushWhenFull