diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-31 01:51:39 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-31 01:51:39 -0400 |
commit | 79231bcff07fce6c08f2266b1e34e8090b12233e (patch) | |
tree | e8d1a4b28f32adc29d4c519500f2c1cbfebae951 /Command | |
parent | 015a497914d0614afff705d5f9acd79d956740ec (diff) |
minor cleanups
mergeFrom is never called on branches that don't exist anymore
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Sync.hs | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs index d8eb0fc39..052f54c44 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -86,7 +86,7 @@ mergeLocal branch = go =<< needmerge go False = stop go True = do showStart "merge" $ Git.Ref.describe syncbranch - next $ next $ mergeFromIfExists syncbranch + next $ next $ mergeFrom syncbranch pushLocal :: Git.Ref -> CommandStart pushLocal branch = go =<< inRepo (Git.Ref.exists syncbranch) @@ -106,17 +106,10 @@ updateBranch syncbranch = , Param $ show $ Git.Ref.base syncbranch ] -mergeFromIfExists :: Git.Ref -> CommandCleanup -mergeFromIfExists branch = go =<< inRepo (Git.Ref.exists branch) - where - go True = do - showOutput - inRepo $ Git.Command.runBool "merge" - [Param (show branch)] - go False = do - showNote $ Git.Ref.describe branch ++ - " does not exist, not merging" - return False +mergeFrom :: Git.Ref -> CommandCleanup +mergeFrom branch = do + showOutput + inRepo $ Git.Command.runBool "merge" [Param $ show branch] pullRemote :: Remote.Remote Annex -> Git.Ref -> CommandStart pullRemote remote branch = do @@ -134,14 +127,15 @@ 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 (== True) <$> mapM go [branch, syncBranch branch] +mergeRemote remote branch = all id <$> mapM go [branch, syncBranch branch] where go b = do e <- inRepo $ Git.Branch.changed branch b if e - then mergeFromIfExists $ remotebranch b + then mergeFrom $ remotebranch b else return True - remotebranch = Git.Ref.under $ "refs/remotes/" ++ Remote.name remote + remotebranch = Git.Ref.under $ + "refs/remotes/" ++ Remote.name remote pushRemote :: Remote.Remote Annex -> Git.Ref -> CommandStart pushRemote remote branch = go =<< needpush |