summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-06 13:02:35 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-06 13:02:35 -0400
commit4a79d9434a5dee771376e1fdc77c3ddf1c99e99d (patch)
treefca0e315c061dc4d2e8a04a6a7aa538cc91ecbd0 /Annex
parentb9d5c418cd5eb89e6ea2de58559da4fe9f487934 (diff)
parent8c0c91f03c4d17e301b16f9607a54cc08d1a0e92 (diff)
Merge branch 'master' into directguard
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Branch.hs18
1 files changed, 10 insertions, 8 deletions
diff --git a/Annex/Branch.hs b/Annex/Branch.hs
index 8192804a6..5978260a1 100644
--- a/Annex/Branch.hs
+++ b/Annex/Branch.hs
@@ -29,6 +29,7 @@ module Annex.Branch (
import qualified Data.ByteString.Lazy.Char8 as L
import qualified Data.Set as S
import qualified Data.Map as M
+import qualified Control.Exception as E
import Common.Annex
import Annex.BranchState
@@ -53,6 +54,7 @@ import Logs.Trust.Pure
import Annex.ReplaceFile
import qualified Annex.Queue
import Annex.Branch.Transitions
+import Annex.Exception
{- Name of the branch that is used to store git-annex's information. -}
name :: Git.Ref
@@ -345,15 +347,15 @@ withIndex' bootstrapping a = do
#endif
let g' = g { gitEnv = Just $ ("GIT_INDEX_FILE", f):e }
- Annex.changeState $ \s -> s { Annex.repo = g' }
- checkIndexOnce $ unlessM (liftIO $ doesFileExist f) $ do
- unless bootstrapping create
- liftIO $ createDirectoryIfMissing True $ takeDirectory f
- unless bootstrapping $ inRepo genIndex
- r <- a
+ r <- tryAnnex $ do
+ Annex.changeState $ \s -> s { Annex.repo = g' }
+ checkIndexOnce $ unlessM (liftIO $ doesFileExist f) $ do
+ unless bootstrapping create
+ liftIO $ createDirectoryIfMissing True $ takeDirectory f
+ unless bootstrapping $ inRepo genIndex
+ a
Annex.changeState $ \s -> s { Annex.repo = (Annex.repo s) { gitEnv = gitEnv g} }
-
- return r
+ either E.throw return r
{- Updates the branch's index to reflect the current contents of the branch.
- Any changes staged in the index will be preserved.