aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Sync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-09-20 16:34:29 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-09-20 16:34:29 -0400
commit5f513ad675e6e128d5d55aca1b8c7d3b8e47f3ae (patch)
tree273ee361e2f19e136a564d8709fdc7cec12f1b20 /Assistant/Sync.hs
parent14f19bdafd2dfcbece16214f168a3f8154a24581 (diff)
assistant: update export db after mergeing git-annex branch changes
Needed so that the assistant can download from exports. updateExportTreeFromLog is normally only run one time, but needs to be run repeatedly during the lifetime of the assistant. This commit was sponsored by Ethan Aubin on Patreon.
Diffstat (limited to 'Assistant/Sync.hs')
-rw-r--r--Assistant/Sync.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Assistant/Sync.hs b/Assistant/Sync.hs
index c6460e9ed..5f08ec81c 100644
--- a/Assistant/Sync.hs
+++ b/Assistant/Sync.hs
@@ -35,6 +35,7 @@ import Assistant.TransferQueue
import Assistant.RepoProblem
import Assistant.Commits
import Types.Transfer
+import Database.Export
import Data.Time.Clock
import qualified Data.Map as M
@@ -218,6 +219,8 @@ manualPull currentbranch remotes = do
forM_ normalremotes $ \r ->
liftAnnex $ Command.Sync.mergeRemote r
currentbranch Command.Sync.mergeConfig def
+ when haddiverged $
+ updateExportTreeFromLogAll
return (catMaybes failed, haddiverged)
where
wantpull gc = remoteAnnexPull gc
@@ -264,3 +267,9 @@ changeSyncFlag r enabled = do
void Remote.remoteListRefresh
where
key = Config.remoteConfig (Remote.repo r) "sync"
+
+updateExportTreeFromLogAll :: Assistant ()
+updateExportTreeFromLogAll = do
+ rs <- exportRemotes <$> getDaemonStatus
+ forM_ rs $ \r -> liftAnnex $
+ openDb (Remote.uuid r) >>= updateExportTreeFromLog