sync: Pushes the git-annex branch to remote/synced/git-annex, rather than directly to remote/git-annex.

This fixes a problem I was seeing in the assistant where two remotes would
attempt to sync with one another at the same time, and both failed pushing
the diverged git-annex branch. Then when both tried to resolve the failed
push, they each modified their git-annex branch, which again each blocked
the other from pushing into it. The result was that the git-annex
branches were perpetually diverged (despite having the same content!) and
once the assistant fell into this trap, it couldn't get out and always
had to do the slow push/fail/pull/merge/push/fail cycle.
This commit is contained in:
Joey Hess 2012-09-16 17:54:12 -04:00
parent e61512f42d
commit 601ee470af
4 changed files with 42 additions and 9 deletions

View file

@ -154,15 +154,15 @@ pushRemote remote branch = go =<< needpush
pushBranch :: Remote -> Git.Ref -> Git.Repo -> IO Bool
pushBranch remote branch g =
Git.Command.runBool "push"
[ Param (Remote.name remote)
, Param (show Annex.Branch.name)
, Param refspec
[ Param $ Remote.name remote
, Param $ refspec Annex.Branch.name
, Param $ refspec branch
] g
where
refspec = concat
[ show $ Git.Ref.base branch
refspec b = concat
[ show $ Git.Ref.base b
, ":"
, show $ Git.Ref.base $ syncBranch branch
, show $ Git.Ref.base $ syncBranch b
]
mergeAnnex :: CommandStart