summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-02-29 16:57:42 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-02-29 16:57:42 -0400
commit927fb6ca6298a15e8f4199618d7f3997573c7d0a (patch)
tree4dd37d8b2b67ff18a7b02716fcf901d056e3f751 /Command
parent6d4ab4dc7389e2184d32962b751268125dfa56ae (diff)
update sync branch to the orig branch when in adjusted branch
Diffstat (limited to 'Command')
-rw-r--r--Command/Sync.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index 0d0358af9..bebe11355 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -269,21 +269,22 @@ updateSyncBranch :: CurrBranch -> Annex ()
updateSyncBranch (Nothing, _) = noop
updateSyncBranch (Just branch, _) = do
-- Update the sync branch to match the new state of the branch
- inRepo $ updateBranch $ syncBranch branch
+ inRepo $ updateBranch (syncBranch branch) branch
-- In direct mode, we're operating on some special direct mode
- -- branch, rather than the intended branch, so update the indended
+ -- branch, rather than the intended branch, so update the intended
-- branch.
whenM isDirect $
- inRepo $ updateBranch $ fromDirectBranch branch
+ inRepo $ updateBranch (fromDirectBranch branch) branch
-updateBranch :: Git.Branch -> Git.Repo -> IO ()
-updateBranch syncbranch g =
+updateBranch :: Git.Branch -> Git.Branch -> Git.Repo -> IO ()
+updateBranch syncbranch updateto g =
unlessM go $ error $ "failed to update " ++ Git.fromRef syncbranch
where
go = Git.Command.runBool
[ Param "branch"
, Param "-f"
, Param $ Git.fromRef $ Git.Ref.base syncbranch
+ , Param $ Git.fromRef $ updateto
] g
pullRemote :: SyncOptions -> Remote -> CurrBranch -> CommandStart
@@ -311,7 +312,7 @@ mergeRemote remote currbranch = ifM isBareRepo
branch <- inRepo Git.Branch.currentUnsafe
mergelisted (pure (branchlist branch))
(Just branch, _) -> do
- inRepo $ updateBranch $ syncBranch branch
+ inRepo $ updateBranch (syncBranch branch) branch
mergelisted (tomerge (branchlist (Just branch)))
)
where