aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Sync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-10-14 15:36:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-10-14 15:36:47 -0400
commitfff7e214e30a1b273f3d11bce4ec22ee0d19bfd5 (patch)
tree1b25bbfbd6928e7f0dc0314b914aa60c688c4468 /Assistant/Sync.hs
parent1e6b79bdec608948560b0b3221aa6b23436be1bf (diff)
only sync with local repos that are currently available (and only fsck them too)
Diffstat (limited to 'Assistant/Sync.hs')
-rw-r--r--Assistant/Sync.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/Assistant/Sync.hs b/Assistant/Sync.hs
index fe4fda896..43f0309fe 100644
--- a/Assistant/Sync.hs
+++ b/Assistant/Sync.hs
@@ -51,10 +51,12 @@ import Control.Concurrent
reconnectRemotes :: Bool -> [Remote] -> Assistant ()
reconnectRemotes _ [] = noop
reconnectRemotes notifypushes rs = void $ do
- modifyDaemonStatus_ $ \s -> s
- { desynced = S.union (S.fromList $ map Remote.uuid xmppremotes) (desynced s) }
- void $ syncAction rs (const go)
- mapM_ signal rs
+ rs' <- filterM (checkavailable . Remote.repo) rs
+ unless (null rs') $ do
+ modifyDaemonStatus_ $ \s -> s
+ { desynced = S.union (S.fromList $ map Remote.uuid xmppremotes) (desynced s) }
+ failedrs <- syncAction rs' (const go)
+ mapM_ signal $ filter (`notElem` failedrs) rs'
where
gitremotes = filter (notspecialremote . Remote.repo) rs
(xmppremotes, nonxmppremotes) = partition isXMPPRemote rs
@@ -80,6 +82,10 @@ reconnectRemotes notifypushes rs = void $ do
signal r = liftIO . mapM_ (flip tryPutMVar ())
=<< fromMaybe [] . M.lookup (Remote.uuid r) . connectRemoteNotifiers
<$> getDaemonStatus
+ checkavailable r
+ | Git.repoIsLocal r || Git.repoIsLocalUnknown r =
+ liftIO $ doesDirectoryExist $ Git.repoPath r
+ | otherwise = return True
{- Updates the local sync branch, then pushes it to all remotes, in
- parallel, along with the git-annex branch. This is the same