summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex/GitOverlay.hs19
-rw-r--r--Annex/Queue.hs1
2 files changed, 16 insertions, 4 deletions
diff --git a/Annex/GitOverlay.hs b/Annex/GitOverlay.hs
index 2193b7449..1b7ceb2e2 100644
--- a/Annex/GitOverlay.hs
+++ b/Annex/GitOverlay.hs
@@ -15,6 +15,7 @@ import Git.Types
import Git.Index
import Git.Env
import qualified Annex
+import qualified Annex.Queue
{- Runs an action using a different git index file. -}
withIndexFile :: FilePath -> Annex a -> Annex a
@@ -71,8 +72,18 @@ withAltRepo
withAltRepo modrepo unmodrepo a = do
g <- gitRepo
g' <- liftIO $ modrepo g
- r <- tryNonAsync $ do
- Annex.changeState $ \s -> s { Annex.repo = g' }
+ q <- Annex.Queue.get
+ v <- tryNonAsync $ do
+ Annex.changeState $ \s -> s
+ { Annex.repo = g'
+ -- Start a separate queue for any changes made
+ -- with the modified repo.
+ , Annex.repoqueue = Nothing
+ }
a
- Annex.changeState $ \s -> s { Annex.repo = unmodrepo g (Annex.repo s) }
- either E.throw return r
+ void $ tryNonAsync Annex.Queue.flush
+ Annex.changeState $ \s -> s
+ { Annex.repo = unmodrepo g (Annex.repo s)
+ , Annex.repoqueue = Just q
+ }
+ either E.throw return v
diff --git a/Annex/Queue.hs b/Annex/Queue.hs
index 0e1b0f68c..9c22e75fd 100644
--- a/Annex/Queue.hs
+++ b/Annex/Queue.hs
@@ -13,6 +13,7 @@ module Annex.Queue (
flush,
flushWhenFull,
size,
+ get,
mergeFrom,
) where