summaryrefslogtreecommitdiff
path: root/Annex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-12 16:41:54 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-12 16:41:54 -0400
commit957dffd030816a067fa6ee3c93f63311ad1f009c (patch)
tree38770fb328269f1ebc45a26fc7a3f3bf88199ae6 /Annex.hs
parent79a3398d4cb3837d51d4431a2bb29a7a70a8f335 (diff)
Bugfix: Fix bug in inode cache sentinal check, which broke copying to local repos if the repo being copied from had moved to a different filesystem or otherwise changed all its inodes'
Diffstat (limited to 'Annex.hs')
-rw-r--r--Annex.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Annex.hs b/Annex.hs
index 2a17fffe1..117bd2862 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -31,6 +31,7 @@ module Annex (
getGitConfig,
changeGitConfig,
changeGitRepo,
+ withCurrentState,
) where
import "mtl" Control.Monad.State.Strict
@@ -216,3 +217,13 @@ changeGitRepo r = changeState $ \s -> s
{ repo = r
, gitconfig = extractGitConfig r
}
+
+{- Converts an Annex action into an IO action, that runs with a copy
+ - of the current Annex state.
+ -
+ - Use with caution; the action should not rely on changing the
+ - state, as it will be thrown away. -}
+withCurrentState :: Annex a -> Annex (IO a)
+withCurrentState a = do
+ s <- getState id
+ return $ eval s a