summaryrefslogtreecommitdiff
path: root/Annex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-04 21:21:52 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-04 21:21:52 -0400
commitcbdaccd44aa8f0ca30afba23fc06dd244c242075 (patch)
treef97fa9d3d77f73d52c03043006ebae1a5e323815 /Annex.hs
parent48efa2d2d34ec532345054d0054dd81cfc597895 (diff)
run event handlers all in the same Annex monad
Uses a MVar again, as there seems no other way to thread the state through inotify events. This is a rather unsatisfactory result. I had wanted to run them in the same monad so that the git queue could be used to coleasce git commands and speed things up. But, that led to fragility: If several files are added, and one is removed before queue flush, git add will fail to add any of them. So, the queue is still explicitly flushed after each add for now. TODO: Investigate using git add --ignore-errors. This would need to be done in Command.Add. And, git add still exits nonzero with it, so would need to avoid crashing on queue flush.
Diffstat (limited to 'Annex.hs')
-rw-r--r--Annex.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/Annex.hs b/Annex.hs
index a9cc68012..38168334d 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -14,6 +14,7 @@ module Annex (
newState,
run,
eval,
+ exec,
getState,
changeState,
setFlag,
@@ -134,6 +135,8 @@ run :: AnnexState -> Annex a -> IO (a, AnnexState)
run s a = runStateT (runAnnex a) s
eval :: AnnexState -> Annex a -> IO a
eval s a = evalStateT (runAnnex a) s
+exec :: AnnexState -> Annex a -> IO AnnexState
+exec s a = execStateT (runAnnex a) s
{- Sets a flag to True -}
setFlag :: String -> Annex ()