summaryrefslogtreecommitdiff
path: root/Annex.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-14 16:13:43 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-14 16:13:43 -0400
commitaa2f4bd81049e3bcaad6f5f1334864ce14887527 (patch)
treec95789d863313ab610a6ebd4514ed2623801dd28 /Annex.hs
parentd4ce0724527fa0155f737b5d3e94e190c27d29dc (diff)
bug
Diffstat (limited to 'Annex.hs')
-rw-r--r--Annex.hs15
1 files changed, 12 insertions, 3 deletions
diff --git a/Annex.hs b/Annex.hs
index fcd19ba03..9be86c948 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -14,9 +14,18 @@ import qualified GitRepo as Git
import Types
import qualified BackendTypes as Backend
--- constructor
-new :: Git.Repo -> AnnexState
-new g = Backend.AnnexState { Backend.repo = g, Backend.backends = [] }
+{- Create and returns an Annex state object for the specified git repo.
+ -}
+new :: Git.Repo -> IO AnnexState
+new g = do
+ let s = Backend.AnnexState { Backend.repo = g, Backend.backends = [] }
+ (_,s') <- Annex.run s (prep g)
+ return s'
+ where
+ prep g = do
+ -- read git config and update state
+ g' <- liftIO $ Git.configRead g
+ Annex.gitRepoChange g'
-- performs an action in the Annex monad
run state action = runStateT (action) state