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.
This commit is contained in:
Joey Hess 2014-06-16 11:32:13 -04:00
parent 55870556df
commit 501cc8623a
5 changed files with 22 additions and 6 deletions

View file

@ -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 =