summaryrefslogtreecommitdiff
path: root/Command/Sync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-06-16 11:32:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-06-16 11:32:13 -0400
commit5b1ea5fe5af25cd88c45a87d3bbe36ea7eed7145 (patch)
treeecbba4af5cd2f7383bcd07f373c9fa99ca847cd8 /Command/Sync.hs
parentf9413b779ee821092af306f30fa9b6e668617432 (diff)
assistant: Fix one-way assistant->assistant sync in direct mode.
When in direct mode, update the master branch after committing to the annex/direct/master branch. Also, update the synced/master branch. This fixes a topology A->B where both A and B are in direct mode and running the assistant, and a change is made to B. Before this fix, A pulled the changes from B, but since they were only on the annex/direct/master branch, it did not merge them. Note that I considered making the assistant merge the remotes/B/annex/direct/master, but decided to keep it simple and only merge the sync branches as before.
Diffstat (limited to 'Command/Sync.hs')
-rw-r--r--Command/Sync.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index a5d6d46f1..983689118 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -172,8 +172,13 @@ mergeLocal (Just branch) = go =<< needmerge
next $ next $ autoMergeFrom syncbranch (Just branch)
pushLocal :: Maybe Git.Ref -> CommandStart
-pushLocal Nothing = stop
-pushLocal (Just branch) = do
+pushLocal b = do
+ updateSyncBranch b
+ stop
+
+updateSyncBranch :: Maybe Git.Ref -> Annex ()
+updateSyncBranch Nothing = noop
+updateSyncBranch (Just branch) = do
-- Update the sync branch to match the new state of the branch
inRepo $ updateBranch $ syncBranch branch
-- In direct mode, we're operating on some special direct mode
@@ -181,7 +186,6 @@ pushLocal (Just branch) = do
-- branch.
whenM isDirect $
inRepo $ updateBranch $ fromDirectBranch branch
- stop
updateBranch :: Git.Ref -> Git.Repo -> IO ()
updateBranch syncbranch g =