diff --git a/Annex/GitOverlay.hs b/Annex/GitOverlay.hs index 2193b74498..1b7ceb2e2d 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 0e1b0f68cc..9c22e75fd0 100644 --- a/Annex/Queue.hs +++ b/Annex/Queue.hs @@ -13,6 +13,7 @@ module Annex.Queue ( flush, flushWhenFull, size, + get, mergeFrom, ) where