summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-30 19:38:46 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-30 19:38:46 -0400
commita31b7d93c85afde1e801748b6a7cf5372492bee8 (patch)
tree4f737fcaf8150ccda69cdca3b427338e499840ff
parent79872e360edcac8106ddb366018519ab41d70695 (diff)
push when git-annex branch changed
I was too heavy-handed in optimising away pushes
-rw-r--r--Command/Sync.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index 4b11e3ac1..a3450278c 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -129,12 +129,16 @@ mergeRemote remote branch = all (== True) <$> mapM go [branch, syncBranch branch
remotebranch = Git.Ref.under $ "refs/remotes/" ++ Remote.name remote
pushRemote :: Remote.Remote Annex -> Git.Ref -> CommandStart
-pushRemote remote branch = go =<< newer
+pushRemote remote branch = go =<< needpush
where
- newer = do
- e <- inRepo (Git.Ref.exists syncbranchRemote)
+ needpush = (||)
+ <$> newer syncbranch
+ <*> newer Annex.Branch.name
+ newer b = do
+ let r = remotebranch b
+ e <- inRepo (Git.Ref.exists r)
if e
- then inRepo $ Git.Branch.changed syncbranchRemote syncbranch
+ then inRepo $ Git.Branch.changed r b
else return True
go False = stop
go True = do
@@ -148,8 +152,7 @@ pushRemote remote branch = go =<< newer
]
refspec = show (Git.Ref.base branch) ++ ":" ++ show (Git.Ref.base syncbranch)
syncbranch = syncBranch branch
- syncbranchRemote = Git.Ref.under
- ("refs/remotes/" ++ Remote.name remote) syncbranch
+ remotebranch = Git.Ref.under $ "refs/remotes/" ++ Remote.name remote
currentBranch :: Annex Git.Ref
currentBranch = Git.Ref . firstLine . L.unpack <$>