summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-13 14:39:26 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-13 14:39:26 -0400
commitae73f85e186a196e341cbc7820f1d47cc0f5700c (patch)
tree4b03969206fd2cd01070eb029cde949b0a4c646f /Assistant
parent50aef92c729000ca0f4345e872b99f5a5f032afd (diff)
better handling of missing index file
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Threads/SanityChecker.hs19
1 files changed, 12 insertions, 7 deletions
diff --git a/Assistant/Threads/SanityChecker.hs b/Assistant/Threads/SanityChecker.hs
index 585a85cdf..b7dd45a21 100644
--- a/Assistant/Threads/SanityChecker.hs
+++ b/Assistant/Threads/SanityChecker.hs
@@ -40,13 +40,18 @@ sanityCheckerStartupThread startupdelay = namedThreadUnchecked "SanityCheckerSta
{- A corrupt index file can prevent the assistant from working at
- all, so detect and repair. -}
- unlessM (liftAnnex $ inRepo $ checkIndex S.empty) $ do
- debug ["corrupt index found at startup; removing"]
- liftAnnex $ inRepo nukeIndex
- {- Normally the startup scan avoids re-staging files,
- - but with the index deleted, everything needs to be
- - restaged. -}
- modifyDaemonStatus_ $ \s -> s { forceRestage = True }
+ ifM (liftAnnex $ inRepo $ checkIndex S.empty)
+ ( do
+ debug ["corrupt index file found at startup; removing and restaging"]
+ liftAnnex $ inRepo nukeIndex
+ {- Normally the startup scan avoids re-staging files,
+ - but with the index deleted, everything needs to be
+ - restaged. -}
+ modifyDaemonStatus_ $ \s -> s { forceRestage = True }
+ , whenM (liftAnnex $ inRepo missingIndex) $ do
+ debug ["no index file; restaging"]
+ modifyDaemonStatus_ $ \s -> s { forceRestage = True }
+ )
{- If there's a startup delay, it's done here. -}
liftIO $ maybe noop (threadDelaySeconds . Seconds . fromIntegral . durationSeconds) startupdelay