From 2998340abb6bd4f9c79ef0079f914955f73f5177 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 31 Dec 2011 02:45:12 -0400 Subject: [PATCH] really fix check that remote needs merged --- Command/Sync.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Command/Sync.hs b/Command/Sync.hs index 29211be92e..2a836ce98d 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -122,15 +122,17 @@ pullRemote remote branch = do - were committed, while the synced/master may have changes that some - other remote synced to this remote. So, merge them both. -} mergeRemote :: Remote.Remote Annex -> Git.Ref -> CommandCleanup -mergeRemote remote branch = all id <$> mapM go [branch, syncBranch branch] +mergeRemote remote branch = all id <$> (mapM merge =<< tomerge) where - go b = do - c <- inRepo $ Git.Branch.changed b (remotebranch b) - if c - then mergeFrom $ remotebranch b - else return True remotebranch = Git.Ref.under $ "refs/remotes/" ++ Remote.name remote + merge = mergeFrom . remotebranch + tomerge = filterM changed [branch, syncBranch branch] + changed b = do + e <- inRepo $ Git.Ref.exists $ remotebranch b + if e + then inRepo $ Git.Branch.changed b $ remotebranch b + else return False pushRemote :: Remote.Remote Annex -> Git.Ref -> CommandStart pushRemote remote branch = go =<< needpush