diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-30 19:38:46 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-30 19:38:46 -0400 |
commit | a31b7d93c85afde1e801748b6a7cf5372492bee8 (patch) | |
tree | 4f737fcaf8150ccda69cdca3b427338e499840ff /Command/Sync.hs | |
parent | 79872e360edcac8106ddb366018519ab41d70695 (diff) |
push when git-annex branch changed
I was too heavy-handed in optimising away pushes
Diffstat (limited to 'Command/Sync.hs')
-rw-r--r-- | Command/Sync.hs | 15 |
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 <$> |